Building a dictionary from a tuple of variable length

bg_ie at yahoo.com bg_ie at yahoo.com
Mon Mar 5 03:43:42 EST 2007


Hi,

I have the following tuple -

t = ("one","two")

And I can build a dictionary from it as follows -

d = dict(zip(t,(False,False)))

But what if my tuple was -

t = ("one","two","three")

then I'd have to use -

d = dict(zip(t,(False,False,False)))

Therefore, how do I build the tuple of Falses to reflect the length of
my t tuple?

Thanks for your help,

Barry.




More information about the Python-list mailing list