In Python 2.7, I get dictionary keys, values, or items as a list:
>>> newdict = {1:0, 2:0, 3:0}
>>> newdict.keys()
[1, 2, 3]
Now, in Python >= 3.3, I get something like this:
>>> newdict.keys()
dict_keys([1, 2, 3])
So, I have to do this to get a list:
newlist = list()
for i in newdict.keys():
newlist.append(i)
I was thinking , is there a better way to return a list in Python 3?