Python 读取写入配置文件 —— ConfigParser Python 读取写入配置文件很方便,可使用内置的 configparser 模块:可查看源码,如博主本机地址: “C:/python27/lib/configparser.py” Configuration file parser. A setup file consists of sections, lead by a "[section]" header, and followed by "name:
以后整理规范 import os import codecs filenames=os.listdir(os.getcwd()) out=file("name.txt","w") for filename in filenames: out.write(filename.decode("gb2312").encode("utf-8")) out.close() 将执行文件的当前目录及文件名写入到name.txt文件中,
一下代码省略了很多,哈哈哈 a.txt文件 uid,type,pointx,pointy,name1,9,911233763,543857286,区间测速起点3,9,906371086,545335469,区间测速起点 ........ 省略千万行数据,哈哈哈 代码 #!/usr/bin/python # encoding: UTF-8 with open(r"D:\work\a.txt", "r") as f: f.readline() i = 0 for lin