#获取IP
import socket
localIP = socket.gethostbyname(socket.gethostname())print "local ip:%s "%localIP
#写入文件
fileHandle.write (localIP)
fileHandle.close()
fileHandle = open ('d:/test.txt','r')
fileList = fileHandle.readlines()
for fileLine in fileList:
print '>>', fileLine
fileHandle.close()