課程
/后端開發
/Python
/初識Python
判斷x是否是字母,為什么這個語句不能運行(x>=65 and x<=90)or (x>=97 and x<=122)
2018-07-20
源自:初識Python 10-3
正在回答
不是有unicode編碼嗎?就跟c語言的asicc編碼一樣可以進行字母間的比較
python是強類型,字符和數字不能進行比較運算。
>>> "a" > 65
Traceback (most recent call last):
? File "<stdin>", line 1, in <module>
TypeError: '>' not supported between instances of 'str' and 'int'
用這個函數 isinstance(x, str)
舉報
學python入門視頻教程,讓你快速入門并能編寫簡單的Python程序
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網安備11010802030151號
購課補貼聯系客服咨詢優惠詳情
慕課網APP您的移動學習伙伴
掃描二維碼關注慕課網微信公眾號
2018-08-25
不是有unicode編碼嗎?就跟c語言的asicc編碼一樣可以進行字母間的比較
2018-08-16
python是強類型,字符和數字不能進行比較運算。
>>> "a" > 65
Traceback (most recent call last):
? File "<stdin>", line 1, in <module>
TypeError: '>' not supported between instances of 'str' and 'int'
2018-07-20
用這個函數 isinstance(x, str)