a = raw_input('How much is 1 share in that company? ')
while not a.isdigit():
print("You need to write a number!\n")
a = raw_input('How much is 1 share in that company? ')
这只在用户输入integer
时起作用,但我希望即使他们输入float
也能起作用,但当他们输入string
时就不起作用。
因此,用户应该能够输入9
和9.2
,但不能输入abc
。
我怎么发动汽车呢?
https://stackoverflow.com/questions/4138202
复制相似问题