0
我在写入配置文件时遇到问题。我有两个Python脚本可以读写同一个文件。问题是当我从一个脚本写入它时,它会覆盖另一个脚本中的内容。ConfigParser覆盖配置文件的内容
这里是我的代码:
authfile = "Users/.ahs" # .ahs is a hidden file
config = ConfigParser.ConfigParser()
tmpfile = open(authfile, "w+")
config.add_section(s)
config.set(s, k, t)
config.write(tmpfile)
tmpfile.close()
谢谢,就是这样。 – 2015-02-23 17:40:44