In python I need to get IP from hostname:
socket.gethostbyname('www.python.org') # returns ip good
socket.gethostbyname('http://python.org') # raises error
I need to deal with hostnames starting with 'http://' so I figured out a way to remake them like this:
a = 'http://python.org'
a.replace('http://', 'www.')
print a # Why does it print http://python.org ???
I'm not sure I do the right thing. Plz help me with translating this type of hostname to IP
b? It should bea.replace('http://', 'www.')http://with an empty string.www.python.orgmight point to a different IP thanpython.org.