persistant options
maxm
maxm at mxm.dk
Sun Dec 16 15:50:43 EST 2001
"Andrei Kulakov" <sill at sill.silmarill.org> wrote in message
news:slrna1q0ud.pf6.sill at sill.silmarill.org...
> Hello,
> I'm looking for solutions or advice on persistant options / config file.
> Here's an example file:
>
> ~/.programrc
> # this option does [...]
> opt1 = 3
>
> When the program is run and this option's changed from inside program,
> it should be written back to the config file.
If you only change the options from inside the program, you could just use a
simple database via "anydbm":
import anydbm
db = anydbm.open('c:/temp/dumbdbm_test', 'c')
db['egg'] = 'eggs'
db['spam'] = 'spammers'
db.close()
del(db)
db = dumbdbm.open('c:/temp/dumbdbm_test', 'r')
print db['egg']
print db['spam']
db.close()
>>>eggs
>>>spammers
regards Max M
More information about the Python-list
mailing list