[Tutor] How to set value back to .conf file

John Fouhy john at fouhy.net
Wed Mar 21 05:53:59 CET 2007


On 21/03/07, hok kakada <hokkakada at khmeros.info> wrote:
> I just start to use ConfigParser to store the configuration for my
> application.
[...]
> Or i need to write it to the file using conf.write(fp)?
> If so, how can I get this file pointer?

Yes.  You need to create a file-like object open for writing.

To continue your example, you can do this:

f = open('test.conf', 'w')
conf.write(f)
f.close()

-- 
John.


More information about the Tutor mailing list