The method keys() returns a list of all the available keys in the dictionary.
Following is the syntax for keys() method:
dict.keys()
NA
This method returns a list of all the available keys in the dictionary.
The following example shows the usage of keys() method.
#!/usr/bin/python dict = {'Name': 'Zara', 'Age': 7} print "Value : %s" % dict.keys()
When we run above program, it produces following result:
Value : ['Age', 'Name']