我该如何做到这一点?
number = int(raw_input("Number: "))
if number != !!!!!!!!NUMBER TYPE IS NOT AN INT TYPEEE!!!!!!!!!
print "NO!"
else
print "YES!"
谢谢! :)
答案 0 :(得分:2)
try:
num = int(raw_input("Number: "))
print("Yes!")
except ValueError:
print("No!")
答案 1 :(得分:0)
number = raw_input("Number: ")
if not number.isdigit():
print "NO!"
else:
print "YES!"