Configfile
Larry Bates
larry.bates at websafe.com
Fri Oct 27 11:04:26 EDT 2006
Fulvio wrote:
> ***********************
> Your mail has been scanned by InterScan MSS.
> ***********************
>
>
> HI,
>
> I've a small doubt regarding the way to save a configuration file on the file
> manipulated by ConfigParser.
> As far as I could understand this:
>
> cp = ConfigParser.ConfigParser
> cp.set(section,option)
>
> will it do the set on the file or do I have to issue a "cp.write(fp)" in order
> to get it done?
> My tests didn't resulted positively.
>
> F
>
>
Yes you have to get a file pointer (fp) and do the write as you noted.
Also to get instance of ConfigParser you need:
cp = ConfigParser.ConfigParser() (note the trailing parenthesis)
If you want to read existing .INI file before doing this you need a
cp.read('filename.ini') somewhere in your code.
-Larry
More information about the Python-list
mailing list