Python3 dictionary keys () method
description
Python dictionary keys () method returns a list of all the keys of a dictionary.
grammar
keys () method syntax:
dict.keys()
parameter
- NA.
return value
Returns a dictionary of all the key.
Examples
The following example shows the keys () method of use:
#!/usr/bin/python3 dict = {'Name': 'w3big', 'Age': 7} print ("字典所有的键为 : %s" % dict.keys())
The above example output is:
字典所有的键为 : dict_keys(['Age', 'Name'])