how to construct a list of only one tuple
TP
Tribulations at Paralleles.invalid
Thu Nov 27 17:39:23 EST 2008
bearophileHUGS at lycos.com wrote:
>> >>> a=("1","2")
>> >>> b=[("3","4"),("5","6")]
>> >>> list(a)+b
>> ['1', '2', ('3', '4'), ('5', '6')]
>
>>>> a = ("1", "2")
>>>> b = [("3", "4"), ("5", "6")]
>>>> [a] + b
> [('1', '2'), ('3', '4'), ('5', '6')]
Thanks a lot.
Why this difference of behavior between list(a) and [a]?
Julien
--
python -c "print ''.join([chr(154 - ord(c)) for c in '*9(9&(18%.9&1+,\'Z
(55l4('])"
"When a distinguished but elderly scientist states that something is
possible, he is almost certainly right. When he states that something is
impossible, he is very probably wrong." (first law of AC Clarke)
More information about the Python-list
mailing list