How can I convert a set to a list in Python? Using
a = set(["Blah", "Hello"])
a = list(a)
doesn't work. It gives me:
TypeError: 'set' object is not callable
Your code does work (tested with cpython 2.4, 2.5, 2.6, 2.7, 3.1 and 3.2):
>>> a = set(["Blah", "Hello"])
>>> a = list(a) # You probably wrote a = list(a()) here or list = set() above
>>> a
['Blah', 'Hello']
Check that you didn't overwrite list
by accident:
>>> assert list == __builtins__.list