Skip to content

How to get the ip address of laptop with Python?

#firstly import socket
import socket
#it is important to get host name get it
host_name = socket.gethostname()
ip_adress = socket.gethostbyname()
print("Ip address of",hostbyname,"is",ip_adress
See also  How to print hello world in Python?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.