parsing text

Adrian Eyre a.eyre at optichrome.com
Mon Feb 7 14:36:28 CET 2000


> import string
> configfile = open ('filename.ext','r')
> name, value = string.split(configfile.readline(),'=')
> config[name] = value

That only does the first line. Try:

import string
configFile = open('filename.ext', 'r')
configDict = {}
for name, value in map(string.split, configFile.readlines()):
	configDict[name] = value

-----------------------------------------------------------------
Adrian Eyre <a.eyre at optichrome.com> - http://www.optichrome.com 





More information about the Python-list mailing list