problem of converting a list to dict
Reedick, Andrew
jr9445 at ATT.COM
Wed Jan 9 14:52:53 EST 2008
> -----Original Message-----
> From: python-list-bounces+jr9445=att.com at python.org [mailto:python-
> list-bounces+jr9445=att.com at python.org] On Behalf Of Fredrik Lundh
> Sent: Wednesday, January 09, 2008 2:39 PM
> To: python-list at python.org
> Subject: Re: problem of converting a list to dict
>
> Louis.Soninhu at gmail.com wrote:
>
> >> to see what's going on on your machine, try printing "a" after the
> >> split, but before you use it to populate the dictionary.
> >
> > 'print a' works
>
> so what does it tell you?
>
A bigger hint:
a=i.split('=')
print "'%s' splits into " % (i), a
assert len(a) == 2
mydict[a[0]]=a[1]
More information about the Python-list
mailing list