Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python get dictionary keys as list

# To get all the keys of a dictionary as a list, see below
newdict = {1:0, 2:0, 3:0}
list(newdict)
# Output:
# [1, 2, 3]
 
PREVIOUS NEXT
Tagged: #python #dictionary #keys #list
ADD COMMENT
Topic
Name
9+6 =