Im creating a program that prints out the Ip adress of the User.
So what im trying to do is to get the Html of ipchicken.com and print out only the “Name Address” Part.
here is my code so far:
import urllib
sock = urllib.urlopen("http://ipchicken.com")
htmlSource = sock.read()
sock.close()
print htmlSource
Now how do i get the ip part of the html printed out?
and if there are other ways to get an ip of the user using python,please include that aswell 🙂
Just run a regex to find IP structure patterns over
htmlSourcethe variable
ipswill contain all literals with a IP structure.The whole code would look like: