Help needed on config files

Rob Wolfe rw at
Wed Jan 31 13:59:46 CET 2007

jvdb wrote:
> Hi there,
> I am quite new on python programming and need some help on solving my
> problem..
> I have to make a (python) program which deletes files from
> directories. I don't think deleting, etc. is the problem. The problem
> is that the directories where i have to delete them are 'dynamic'/
> subject to change. So what i thought is to make a config file
> containing an identifier (useful for myself) and there the directory.
> something like:
> <path>
> <path>

What about this?

# proj.cfg

from ConfigParser import ConfigParser
cfg = ConfigParser()"proj.cfg")
for proj in cfg.sections():
    path = cfg.items(proj)[0][1]
    print "proj: %s, path: %s" % (proj, path)

Is that not enough?


More information about the Python-list mailing list