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

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

.lower 不適用于我在 pycharm 中的代碼

.lower 不適用于我在 pycharm 中的代碼

拉風(fēng)的咖菲貓 2023-08-22 17:07:09
我是 python 新手,這是我的代碼,.lower 通常可以工作,但這次不行。technical_dict = {        dict : 'stores a key/value pair',        list : 'stores a value at each index',        map : 'see dict',        set : 'stores unordered unique elements'    }    userInput = (input("What term would you like to lookup or type 'exit' to stop:"))    if userInput.lower() not in technical_dict:        print("Term does not exist in technical dictionary")    if userInput.lower()  in technical_dict:        print(technical_dict[userInput.lower()])        while userInput.lower() != "exit":            userInput = input("What term would you like to lookup or type 'exit' to stop:")            if userInput.lower() in technical_dict:        print(technical_dict[userInput.lower()])            if userInput.lower() not in technical_dict:                print("Term does not exist in technical dictionary")                break
查看完整描述

1 回答

?
慕勒3428872

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

您創(chuàng)建詞典的方式似乎存在問題。您現(xiàn)在擁有的鍵值不是 string 或 str 類型。這就是為什么您會(huì)收到字典沒有屬性“l(fā)ower”的錯(cuò)誤。要修復(fù)此問題,您需要更改這些值,使其成為字符串類型。嘗試這個(gè):


technical_dict = {

        'dict' : 'stores a key/value pair',

        'list' : 'stores a value at each index',

        'map' : 'see dict',

        'set' : 'stores unordered unique elements'

    }


查看完整回答
反對 回復(fù) 2023-08-22
  • 1 回答
  • 0 關(guān)注
  • 191 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號(hào)

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