字典(Dictionary) python 创建一个空字典 emptydict = {} print(emptydict) # 输出: {} 创建包含初始键值对的字典 studentinfo = { "name": "Alice", "age": 20, "major": "Computer Science" } print(studentinfo) # 输出: {'name': 'Alice', 'age': 20, 'major': 'Computer Science'} python pairs = [('a', 1), ('b', 2), ('c', 3)] mydict = dict(pairs) print(mydict) # 输出: {'a': 1, 'b': 2, 'c':