Articles → Python → Get The List Of Keys In Dictionary Using Keys Method In Python
Get The List Of Keys In Dictionary Using Keys 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
Posted By - | Karan Gupta |
|
Posted On - | Thursday, April 4, 2019 |