# Python 字典 字典的基本使用,插入key-value,并打印结果 ```python if __name__ == '__main__': map = {} map['name'] = "monkey" map['age'] = 25 map['tags'] = "猴子" map['tags'] = ['程序员', '户外达人'] map['profile'] = {'info1': "test", "info2": "test"} print(map['tags']) print(map['profile'].get("info3")) ``` 上述代码的打印结果是? ## template ```python if __name__ == '__main__': map = {} print('* 初始化字典:', map) print('* 使用下标插入数据到字典') map['name'] = "monkey" map['age'] = 25 map['no'] = 10000 for key in map: value = map[key] print("{}:{}".format(key, value)) print('* 字典里可以插入其他数据类型,例如插入列表') map['tags'] = ['程序员', '户外达人'] print('* 打印 tags :{}', map.get('tags')) print('* 字典里可以插入其他数据类型,例如插入字典') map['profile'] = {'info1': "test", "info2": "test"} print('* 打印 profile :{', map.get('profile')) ``` ## 答案 ```python ['程序员', '户外达人'] None ``` ## 选项 ### A ```python 猴子 None ``` ### B ```python 猴子 test ``` ### C ```python ['程序员', '户外达人'] test ```