#663 获取本地ip地址   python     snippets     tcp/ip     11 months ago (owner) Document
import socket

def get_host_ip():
	try:
		s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
		s.connect(('8.8.8.8', 80))
		ip = s.getsockname()[0]
	finally:
		s.close()
		
	return ip

print(get_host_ip())