list to tuple and vice versa

Discussion in 'Python' started by Jabba Laci, Oct 18, 2009.

  1. Jabba Laci

    Jabba Laci Guest

    Hi,

    I have some difficulties with list -> tuple conversion:

    t = ('a', 'b')
    li = list(t) # tuple -> list, works
    print li # ['a', 'b']

    tu = tuple(li) # list -> tuple, error
    print tu # what I'd expect: ('a', 'b')

    The error message is: "TypeError: 'tuple' object is not callable".

    Thanks,

    Laszlo
     
    Jabba Laci, Oct 18, 2009
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jimmy
    Replies:
    1
    Views:
    3,188
    Eliyahu Goldin
    Jun 14, 2005
  2. carmen
    Replies:
    4
    Views:
    30,815
    ersecchio
    Jan 12, 2010
  3. Thorsten Kampe
    Replies:
    3
    Views:
    311
    Roy Smith
    Apr 29, 2004
  4. Jabba Laci

    Re: list to tuple and vice versa

    Jabba Laci, Oct 18, 2009, in forum: Python
    Replies:
    2
    Views:
    324
    StarWing
    Oct 18, 2009
  5. Peter Otten
    Replies:
    1
    Views:
    169
    Andreas Perstinger
    Jun 18, 2013
Loading...

Share This Page