Hi,
> Therefore, how do I build the tuple of Falses to reflect the length of my t
> tuple?
Yet another solution :
d = dict(zip(t,[False]*len(t)))
Pierre
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] kirjoitti:
> 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,(Fals
[EMAIL PROTECTED] wrote:
> 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,Fals
In <[EMAIL PROTECTED]>, bg_ie wrote:
> Therefore, how do I build the tuple of Falses to reflect the length of
> my t tuple?
In [1]: dict.fromkeys(('one', 'two', 'three'), False)
Out[1]: {'three': False, 'two': False, 'one': False}
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org
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