Automatically Writing a Dictionary

Tim Chase python.list at tim.thechases.com
Fri Jan 25 11:23:40 EST 2008


>>  d = dict(line.split(',').rstrip('\n')?
>
> Thanks. That worked except for the rstrip. So I did this:

Sorry...I got the order wrong on them (that's what I get for
editing after copy&pasting).  They should be swapped:

 d = dict(line.rstrip('\n').split(','))

to strip off the newline before you split it.

-tkc







More information about the Python-list mailing list