how to construct a list of only one tuple

bearophileHUGS at lycos.com bearophileHUGS at lycos.com
Thu Nov 27 13:43:01 EST 2008


TP:
> >>> 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')]

Bye,
bearophile



More information about the Python-list mailing list