list to tuple and vice versa

Jabba Laci jabba.laci at gmail.com
Sat Oct 17 23:24:01 EDT 2009


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



More information about the Python-list mailing list