Analyzing is not a number isdigit ()

 

Analyzing salary is not digital, if it is normally performed on a digital, digital prints must not be prompted to input digit,

salary=input("salary:")

if
salary.isdigit(): the salary = int (the salary) the else : Print ( " MUST digit for INPUT " )



output:
the salary: 80

the salary: SDS

Traceback (most recent call last):
File "F:/python/week1/day5/test.py", line 1, in <module>
'''%(name,name,age,job,salary,int(65-age),int(salary))
ValueError: invalid literal for int() with base 10: 'sds

 

Guess you like

Origin www.cnblogs.com/daino/p/11847851.html