converting tuple to a list

Mikael Olofsson mikael at isy.liu.se
Wed Jan 12 07:58:28 EST 2000


On 12-Jan-00 Anders M Eriksson wrote:
 >  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])

I don't know if this is better, but at least it looks better to me.

l=map(None,t)

/Mikael

-----------------------------------------------------------------------
E-Mail:  Mikael Olofsson <mikael at isy.liu.se>
WWW:     http://www.dtr.isy.liu.se/dtr/staff/mikael
Phone:   +46 - (0)13 - 28 1343
Telefax: +46 - (0)13 - 28 1339
Date:    12-Jan-00
Time:    13:57:01

This message was sent by XF-Mail.
-----------------------------------------------------------------------



More information about the Python-list mailing list