list to tuple and vice versa

Jabba Laci jabba.laci at gmail.com
Sun Oct 18 05:24:01 CEST 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