Learn to Code via Tutorials on Repl.it!

← Back to all posts
how to make an ip logger in python
Kloco12

import socket

def get_Host_name_IP():
try:
host_name = socket.gethostname()
host_ip = socket.gethostbyname(host_name)
print("Hostname : ",host_name)
print("IP : ",host_ip)
except:
print("Unable to get Hostname and IP")

get_Host_name_IP()

Voters
FagnerR
cmglj
Kloco12