【Python】由host得到IP
代码:
import socket host='www.163.com' ip=socket.gethostbyname(host) print('Ip of {} is {}'.format(host,ip))
输出:
C:\Users\horn1\Desktop\python\51-gethostip>python gethostip.py Ip of www.163.com is 219.232.42.124
2018年5月15日
代码:
import socket host='www.163.com' ip=socket.gethostbyname(host) print('Ip of {} is {}'.format(host,ip))
输出:
C:\Users\horn1\Desktop\python\51-gethostip>python gethostip.py Ip of www.163.com is 219.232.42.124
2018年5月15日