更新時(shí)間:2021-12-21 來源:黑馬程序員 瀏覽量:
scores_dict = {'語文': 105, '數(shù)學(xué)': 140, '英語': 120} for key in scores_dict: print(key)
scores_dict = {'語文': 105, '數(shù)學(xué)': 140, '英語': 120} for value in scores_dict.values(): print(value)
scores_dict = {'語文': 105, '數(shù)學(xué)': 140, '英語': 120} for key in scores_dict: print(key + ":" + str(scores_dict[key])) # 返回字符串
scores_dict = {'語文': 105, '數(shù)學(xué)': 140, '英語': 120} for i in scores_dict.items(): print(i) # 返回元組
scores_dict = {'語文': 105, '數(shù)學(xué)': 140, '英語': 120} for key, value in scores_dict.items(): print(key + ':' + str(value))
加QQ:435946716獲取上面視頻的全套資料【視頻+筆記+源碼】
猜你喜歡: