Python: How can I make this work?
本问题已经有最佳答案,请猛点这里访问。
我怎样才能做到这一点?
1 2 3 4 5 | number = int(raw_input("Number:")) if number != !!!!!!!!NUMBER TYPE IS NOT AN INT TYPEEE!!!!!!!!! print"NO!" else print"YES!" |
谢谢!!)
1 2 3 4 5 | try: num = int(raw_input("Number:")) print("Yes!") except ValueError: print("No!") |
1 2 3 4 5 6 | number = raw_input("Number:") if not number.isdigit(): print"NO!" else: print"YES!" |