使用下列程序可获取到自身IP地址。
import socket
def GetHostIP():
hostname = socket.gethostname()
ip = socket.gethostbyname(hostname)
return ip
嵌入式系统开发笔记72:使用Python语言获取本机IP地址
阅读 56
2022-02-10
使用下列程序可获取到自身IP地址。
import socket
def GetHostIP():
hostname = socket.gethostname()
ip = socket.gethostbyname(hostname)
return ip
相关推荐
精彩评论(0)