Skip to content

techcvr/get-IP-Address-of-your-computer-using-Python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

How to get IP Address of your computer using Python

In this post we will learn How to get IP address of your computer in python.

You have to first import socket library and then use:

IP =socket.gethostbyname(hostname)

and then print the value of the ip into the print() function your IP address will be displayed as shown in the snippet.

import socket
hostname = socket.gethostname()
IPAddr = socket.gethostbyname(hostname)

print("Your Computer Name is: " + hostname)
print("Your Computer IP Address is: " + IPAddr)

That’s all you need my friend. its that simple.

About

How to get IP Address of your computer using Python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published