本文实例讲述了python在Windows8下获取本机ip地址的方法。分享给大家供大家参考。具体实现方法如下:
import socket hostname = socket.gethostname() IPinfo = socket.gethostbyname_ex(hostname) LocalIP = IPinfo[2][2] print LocalIP
希望本文所述对大家的Python程序设计有所帮助。
以上是小编为您精心准备的的内容,在的博客、问答、公众号、人物、课程等栏目也有的相关内容,欢迎继续使用右上角搜索按钮进行搜索python
, 方法
, ip地址
, windows8
, 获取
本机
python 获取ip地址、python获取网卡ip地址、python获取本机ip地址、python3 获取ip地址、windows获取ip地址,以便于您获取更多的相关知识。
时间: 2024-09-18 21:35:17