Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我只想知道如何在导入系统情况下检查它是否为数字。并想知道为什么我没有使用代码A.isalpha()得到输出“Hello”
该方法A.isalpha()返回布尔值True或False不返回字符串"True",您可以像这样比较布尔值
A.isalpha()
True
False
"True"
if A.isalpha() is True: print("hello")
但正如 a 所if期望的布尔语句,返回值 fromisalpha已经很好
if
isalpha
if A.isalpha(): print("hello")