代码如下:
from ConfigParser import RawConfigParser as rcp if __name__ == "__main__": cfg = rcp() cfg.add_section("Info") cfg.set("Info", "ImagePath", "f:/whu") cfg.set("Info", "foo", "cd's information") cfg.write(open("f:/Whu/try.ini","w")) # #[Info] #imagepath = f:/whu www.jb200.com #foo = cd's information