- 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
- #foo = cd's information
- #该片段来自于http://www.codesnippet.cn/detail/260320132565.html
来源: http://www.codesnippet.cn/detail/260320132565.html