摘要:
曾经写过一个脚本在Linux系统上来获得本地的IP地址:#!/usr/bin/env pythonimport socketimport structimport fcntlimport sysdef getip(ethname): if ethname=="": ethname="eth0" try: s=socket.socket(socket.AF_INET, socket.SOCK_DGRAM) ip=socket.inet_ntoa(fcntl.ioctl(s.fileno(), 0X8915, struct.pack('256s... 阅读全文
posted @ 2012-08-24 10:17 feisky 阅读(1158) 评论(1) 推荐(0) 编辑