import socket
host_name = socket.gethostname()
ip = socket.gethostbyname(host_name)
print("本地IP地址是:" + ip)
socket 获取局域网IP地址
如果觉得文章不错,可以分享给其他人哟~
import socket
host_name = socket.gethostname()
ip = socket.gethostbyname(host_name)
print("本地IP地址是:" + ip)