第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

創(chuàng)建一個(gè)將人名用作鍵的字典后,輸入姓名查找值,返回錯(cuò)誤

創(chuàng)建一個(gè)將人名用作鍵的字典后,輸入姓名查找值,返回錯(cuò)誤

一只斗牛犬 2019-02-17 06:46:36
創(chuàng)建了將人名用作鍵的字典,輸入姓名查找值,返回錯(cuò)誤。代碼: people={ 'Alice': { 'phone': '6789', 'addr': 'Ruan road 23' }, 'Mary':{ 'phone': '8769', 'addr': 'Foo drive 66' }, 'Jay': { 'phone': '6666', 'addr': 'Bar street 88' } } labels={ 'phone':'phone number', 'addr':'address' } name=input('Name:') request=input('phone number(p) or address(a)?') if request=='p':key='phone' if request=='a':key='addr' if name in people: print("{}'s {} is {}.".format(name,labels[key],people[name][key])) 錯(cuò)誤: D:\anaconda2-5.3\python.exe C:\Users\59131\.IntelliJIdea2018.2\config\plugins\python\helpers\pydev\pydevd.py --multiproc --qt-support=auto --client 127.0.0.1 --port 55756 --file C:/Users/59131/.IntelliJIdea2018.2/config/scratches/04dict1.py pydev debugger: process 23116 is connecting Connected to pydev debugger (build 182.4892.20) Name:Jay Traceback (most recent call last): File "C:\Users\59131\.IntelliJIdea2018.2\config\plugins\python\helpers\pydev\pydevd.py", line 1664, in <module> main() File "C:\Users\59131\.IntelliJIdea2018.2\config\plugins\python\helpers\pydev\pydevd.py", line 1658, in main globals = debugger.run(setup['file'], None, None, is_module) File "C:\Users\59131\.IntelliJIdea2018.2\config\plugins\python\helpers\pydev\pydevd.py", line 1068, in run pydev_imports.execfile(file, globals, locals) # execute the script File "C:/Users/59131/.IntelliJIdea2018.2/config/scratches/04dict1.py", line 20, in <module> name=input('Name:') File "<string>", line 1, in <module> NameError: name 'Jay' is not defined
查看完整描述

2 回答

?
白衣染霜花

TA貢獻(xiàn)1796條經(jīng)驗(yàn) 獲得超10個(gè)贊

你用的 python2. 使用 raw_input;

name=raw_input('Name:')
查看完整回答
反對(duì) 回復(fù) 2019-03-01
?
臨摹微笑

TA貢獻(xiàn)1982條經(jīng)驗(yàn) 獲得超2個(gè)贊

我copy你的code一切正常,沒(méi)有異常,我用的是qpython3

查看完整回答
反對(duì) 回復(fù) 2019-03-01
  • 2 回答
  • 0 關(guān)注
  • 930 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)