问题:
I know about islower
and isupper
, but can you check whether or not that character is a letter?我知道islower
和isupper
,但是你能检查那个字符是否是一个字母吗? For Example:例如:
>>> s = 'abcdefg'
>>> s2 = '123abcd'
>>> s3 = 'abcDEFG'
>>> s[0].islower()
True
>>> s2[0].islower()
False
>>> s3[0].islower()
True
Is there any way to just ask if it is a character besides doing .islower()
or .isupper()
?除了做.islower()
或.isupper()
之外,还有什么方法可以询问它是否是一个字符?
解决方案:
参考一: https://en.stackoom.com/question/13HRo参考二: https://stackoom.com/question/13HRo