亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

為何返回一個字典時,提供的信息location = 'princeton'。(變量location =字符串'princeton')這里會變成鍵-值對呢,不是'location':'princeton'才對嗎,而且location在打印的時候自動變成字符串而不是變量了。

def build_profile(first,last,**user_info):

? ? '''創建一個字典,其中包含所有用戶信息'''

? ? profile = {}

? ? profile ['first_name'] = first

? ? profile ['last_name'] = last

? ? for key,value in user_info.items():

? ? ? ? profile[key] = value

? ? return profile


user_profile = build_profile('albert','einstein',

? ? ? ? ? ? ? ? ? ? ? ? ? ? ?location = 'princeton',field = 'physics')

print(user_profile)


正在回答

1 回答

....

0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消
初識Python
  • 參與學習       758392    人
  • 解答問題       8967    個

學python入門視頻教程,讓你快速入門并能編寫簡單的Python程序

進入課程

為何返回一個字典時,提供的信息location = 'princeton'。(變量location =字符串'princeton')這里會變成鍵-值對呢,不是'location':'princeton'才對嗎,而且location在打印的時候自動變成字符串而不是變量了。

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號