#1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Posts
    67
    Rep Power
    11

    Question Convert a tuple to a list?


    How do you convert a tuple to a list?
    Thanks in advance.
    Before you criticize someone, walk a mile in their shoes, that way when you do criticize them, you're a mile away and you have their shoes!
  2. #2
  3. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    Python is actually pretty efficent at converting tuples to lists and back again.. not to mention it being very easy!

    I'm sure you've seen (if not used used) the str() type-cast function before, well same thing here with list()..

    >>> t = ('my', 'name', 'is', 'mr', 'tuple')
    >>> t
    ('my', 'name', 'is', 'mr', 'tuple')
    >>> l = list(t)
    >>> l
    ['my', 'name', 'is', 'mr', 'tuple']
    >>>

    Mark
    programming language development: www.netytan.com Hula

  4. #3
  5. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Posts
    67
    Rep Power
    11
    OK, thanks.
    Before you criticize someone, walk a mile in their shoes, that way when you do criticize them, you're a mile away and you have their shoes!

IMN logo majestic logo threadwatch logo seochat tools logo