小册名称:Python合辑4-130个字符串操作示例
检查字符串中的所有字符是否都是Python中的数字
a = "1000"x = a.isdigit()print(x)b = "A1000"x = b.isdigit()print(x)
a = "1000"
x = a.isdigit()
print(x)
b = "A1000"
x = b.isdigit()
Output:
TrueFalse
True
False