使用python获取本地ip

import socket
ip = socket.gethostbyname(socket.gethostname())
print(ip)
原文地址:https://www.cnblogs.com/brainstorming/p/7654608.html