1import socket
2local_ip = socket.gethostbyname(socket.gethostname)
3print(f"[+] Your Local IP is : {local_ip}")
1import socket
2host = socket.getfqdn()
3addr = socket.gethostbyname(host)
4print(f"Your ip is {addr}")
5# On Linux, it may give you the localhost address
1import socket
2local_ip = socket.gethostbyname(socket.gethostname())
3print(f"[+] Your Local IP is : {local_ip}")