number = raw_input("Enter a number.")
def function(number):
if number % 9 == 0:
print 9
else:
print number % 9
尝试运行时我得到以下内容:
Enter a number.Traceback (most recent call last):
File "script.py", line 1, in <module>
number = raw_input("Enter a number.")
EOFError: EOF when reading a line
该怎么做?
答案 0 :(得分:0)
raw input
将您的输入转换为字符串。您应该将其转换为int,以便将其作为数字使用:
number = int(raw_input("Enter a number."))