devi thapa wrote:
hi allI have one normal text file. I need to parse the file, that too in an associative way .suppose that below is the normal textfilename='adf' id =1 value=344
there are many approaches to config files. But
in your special example, it looks like a simplified
mapping, so
parsed=eval("dict(%s)" % ",".join(line
for line
in file("textfile")
if line.strip()
)
)
>>> parsed['name']
'adf'
but of course eval() is dangerous, so feel free to
explore more then this one solution.
Regards
Tino
smime.p7s
Description: S/MIME Cryptographic Signature
-- http://mail.python.org/mailman/listinfo/python-list
