Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Conver to List
#1
I am playing to convert a tuple to a list. I thought using list() is simple, but not...What's wrong?


aTuple = (123, 'xyz', 'zara', 'abc');
aList = list(aTuple)
print ("List elements : ", aList)
Output:
------------------
aList = list(aTuple)
TypeError: 'list' object is not callable

I am using Python 3.5 with Eclipse
Reply
#2
You must of previously before this written over python's built-in list such as in this example

>>> list
<class 'list'>
>>> list = list('abc')
>>> list
['a', 'b', 'c']
>>> example = list('uh-oh')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'list' object is not callable
Recommended Tutorials:
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to conver txt file data to python? yunglin 1 2,050 Jun-13-2019, 07:50 PM
Last Post: micseydel

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020