Fortune Telling Collection - Comprehensive fortune-telling - Python fortune-telling dictionary _python dictionary algorithm

Python fortune-telling dictionary _python dictionary algorithm

How to take out the key of dictionary in python

Examples are as follows:

1. Add python file, testdictkey.py;;

2. Write python code, define dictionary and obtain key; Dictionary;

My _ dictionary? =? dict(name="lili ",? Age =32, Money = 1200, Hourse = none)

key_list? =? my_dict.keys()

Print (list (key_list))

3. Select "Run Python file in terminal";

4, check the running results, you can output all the keys of the dictionary; ['name',' age',' money',' hour']