On 10/11/10 07:36, Ian Kelly wrote:
On 11/9/2010 11:14 PM, r0g wrote:
Me too when possible, TBH if I only needed strings and there was no
pressing security issue I'd just do this...
config = {}
for line in (open("config.txt", 'r')):
if len(line) > 0 and line[0] <> "#":
param, value = line.rstrip().split("=",1)
config[param] = value
That's five whole lines of code. Why go to all that trouble when you can
just do this:
import config
Heh, mainly because I figure the config module will have a lot more
options than I have use for right now and therefore the docs will take
me longer to read than I will save by not just typing in the above ;)
Having said that, you've just prompted me to take a look... there goes
another 10 minutes of my life!
Roger
--
http://mail.python.org/mailman/listinfo/python-list