虽然我输入了一个数值,但它仍然给我一个错误。我不知道为什么会这样..帮助别人?
def is_string(s):
rate = input(s)
try:
str.isalpha(rate)
print('There was an error. Please try again. Make sure you use numerical values and alpabetical. ')
return is_string(s) #ask for input again
except:
return rate
ExRate = is_string('Please enter the exchange rate in the order of, 1 '+Currency1+' = '+Currency2)
def is_string2(msg):
amount = input(msg)
try:
str.isalpha(amount)
print('There was an error. Please try again. Make sure you use numerical values. ')
return is_string2(msg) #ask for input again
except:
return amount
Amount = is_string2('Please enter the amount you would like to convert:')