Feb-02-2017, 07:19 AM
(This post was last modified: Feb-02-2017, 07:20 AM by landlord1984.)
dict={'a':'aaa','b':'bbb','c':'ccc'} list(dict.keys())
Quote:TypeError Traceback (most recent call last)
<ipython-input-60-be97bb392967> in <module>()
----> 1 list(dict.keys())
TypeError: 'list' object is not callable
I want to get a list of the keys of a dictionary for further manipulation. But don't know why this does not work. Somebody here:http://stackoverflow.com/questions/17322...t-indexing
suggested they can do by this way, but it does not work for me.
Another question is: Can I access dictionary by index instead of key?
Thanks,
L