How do I return dictionary keys as a list in Python?

With Python 2.7, I can get dictionary keys, values, or items as a list:

>>> newdict = {1:0, 2:0, 3:0}
>>> newdict.keys()
[1, 2, 3]

With Python >= 3.3, I get:

>>> newdict.keys()
dict_keys([1, 2, 3])

How do I get a plain list of keys with Python 3?

← Назад к списку