#coding:utf8 if __name__ == '__main__': srcfile = u"D:/测试路径/测试文件.txt" f = open(srcfile.encode('gbk')) for text in f.readlines(): print text.decode('gbk') f.close()
python 获取 mac 地址 的例子,有需要的朋友可以参考下. #!/bin/python import os import re def GetMac(): if os.name == 'nt': try: ret = '' CmdLine = 'ipconfig /all' r = os.popen(CmdLine).read() if r: