(python) print host name and ip

#print host name and ip address
import socket

hostn = socket.gethostname()
thispc = socket.gethostbyname(hostn)

print(“Host name = “+hostn)
print(“IP Address = “+thispc)

Leave a comment