更新时间:2021-12-21 来源:黑马程序员 浏览量:
scores_dict = {'语文': 105, '数学': 140, '英语': 120} for key in scores_dict: print(key)
scores_dict = {'语文': 105, '数学': 140, '英语': 120} for value in scores_dict.values(): print(value)
scores_dict = {'语文': 105, '数学': 140, '英语': 120} for key in scores_dict: print(key + ":" + str(scores_dict[key])) # 返回字符串
scores_dict = {'语文': 105, '数学': 140, '英语': 120} for i in scores_dict.items(): print(i) # 返回元组
scores_dict = {'语文': 105, '数学': 140, '英语': 120} for key, value in scores_dict.items(): print(key + ':' + str(value))
加QQ:435946716获取上面视频的全套资料【视频+笔记+源码】
猜你喜欢: