converting tuple to a list

Bill Scherer scherbi at bam.com
Wed Jan 12 07:56:26 EST 2000


Not really.  Try the list function:

>>> t = (1,2,3,4)
>>> l = list(t)
>>> l
[1, 2, 3, 4]
>>>

Bill Scherer

Anders M Eriksson wrote:

> Hello!
>
> Is this the 'best' way to convert a tuple to a list?
>
> t = (1,2,3,4,5)
> l = []
>
> for i in range(len(t)):
>         l.append(t[i])
>
> // Anders
>
> --
> http://www.python.org/mailman/listinfo/python-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: scherbi.vcf
Type: text/x-vcard
Size: 226 bytes
Desc: Card for Bill Scherer
URL: <http://mail.python.org/pipermail/python-list/attachments/20000112/97825d6f/attachment.vcf>


More information about the Python-list mailing list