Home >>Python Dictionary Methods >Python Dictionary keys() Method
Python Dictionary keys() Method in python dictionary is used to returns a list of keys and fetch all the keys from the dictionary.
Syntax:dictionary.keys()Here is an example of Python Dictionary keys() Method:
colors = {
"color1": "white",
"color2": "blue",
"color3": "green"
}
z = colors.keys()
print(z)
prdct = {'name':'mobile','brand':'MI','price':25000}
for p in prdct.keys():
if p == 'price' and prdct[p] > 15000:
print(" price is too high",)