Articles → Python → Get the list of keys in dictionary using key method in python

Get the list of keys in dictionary using

key method in python






Code


# A dictionary with 2 keys i.e. name and age
dict = {"name":"gyan", "age":18}

# Convert to list and print list of keys
print("List of keys", list(dict.keys()))



Output



Click to Enlarge


Posted By  -  Karan Gupta
 
Posted On  -  Thursday, April 04, 2019

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250