config parser -help - anybody please immediately help for me...
python.list at tim.thechases.com
Fri Apr 3 17:01:43 CEST 2009
1) Posting the same question multiple times in a 3 hour span
isn't likely to get you anything more than people who get peeved
at your impatience. Take a moment to realize that you posted at
4:00am for my local (CST/CDT) time. That means that, at least
for those of us in the US, you posted between 2:00am and 5:00am.
Most of us in this swath of the globe are asleep at that hour.
Our good brothers & sisters across the pond have been awake for
a while, but remember you're only addressing a portion of the
newsgroup until you've let at least 16-24 hours pass.
2) Post the question clearly the first time, to the best of your
ability. With verbs: "i want to all my configuration file
names..." You want to WHAT all your configuration file names?
Your second post hints that you want to automatically tack on the
extension, an aspect that you *totally* omitted in the initial
posting. To answer what I believe you're asking, yes, you do
have to supply the full filename (not just the directory). You
can use a list-comprehension to tack on extensions if you want,
but for only 2 file-names, it's a bit of overkill:
["%s.cfg" % path for path in lst_of_filenames_without_ext]
If you, for some crazy reason, want to match all the filenames in
a directory matching the pattern "*.cfg", you can use the "glob"
module. However, a lot of files with .cfg extensions don't need
to be in "INI" format (the format read by configparser), so
trying to use configparser to read them may fail.
3) "anybody please immediately help for me". whine, whine. You
already have a working solution. You're only looking to tweak
the code for some unfathomable reason. There's no apparent need
for urgency unless you're taking an exam or have a homework
problem due that you haven't been able to figure out. Give it a
More information about the Python-list