Reputation: 41
How to convert domain name to IP in URL link, many thanks !
Draft Code:
import socket
ip_add = socket.gethostbyname("stopatnothing.com")
url = 'http://ip_add+:80/clients/'
expected result:
http://204.232.151.56:80/clients/
Upvotes: 1
Views: 3002
Reputation: 34698
import socket
ip_add = socket.gethostbyname("stopatnothing.com")
url = 'http://%s:80/clients/' % ip_add
Upvotes: 6