Python dictionary keys() method
Python Dictionary keys() Method
Description
The Python dictionary method keys() returns a list of all available keys in the dictionary.
Syntax
Below is the syntax of the keys() method −
dict.keys()
Parameters
NA
Return Value
This method returns a list of all available keys in the dictionary.
Example
The following example demonstrates the usage of the keys() method.
dict = {'Name': 'Zara', 'Age': 7}
print "Value : %s" % dict.keys()
When running the above program, the following output is produced –
Value : ['Age', 'Name']