Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Python How to get the keys in a dictionary?

# Python program to get 
# dictionary keys as list
  
def getList(dict):
    list = []
    for key in dict.keys():
        list.append(key)
          
    return list
      
# Driver program
dict = {1:'Geeks', 2:'for', 3:'geeks'}
print(getList(dict))
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #Python #How #keys
ADD COMMENT
Topic
Name
9+9 =