对Python来说很新颖,我使用2.7来编写脚本。我该如何循环这个
a = raw_input("Input number or decimal only")
Try:
Y = float(a)
print a
except ValueError:
print "wrong input, try again"
我需要循环 - 如果输入是字母数字或字母,它应该再次要求输入。
我似乎无法找到一种方法在它的while循环中滑动。
(Python的新手,请善待!)
有没有中 '休息'你复制粘贴你的代码或重新输入它?因为这个代码不会运行。 – idjaw
你有没有尝试用'while True:'块封装整个事物? –