当我在run.py中编写它时,它会有意外的缩进,但当我在python控制台中编写它时,它会正常工作
from pip._vendor.distlib.compat import raw_input
def hello(a, b):
if b != 0:
wynik = a/b
return wynik
else:
wynik = "No result"
return wynik
a = raw_input('Number A:')
b = raw_input("Number B:")
if not a is None and not b is None:
print(hello(float(a),float(b)))
else:
print("A or B must be filled")
raw_input()
这是日志:
C:\Users\Student\PycharmProjects\untitled>run.py
File "C:\Users\Student\PycharmProjects\untitled\run.py", line 17
if not a is None and not b is None:
^
IndentationError: unexpected indent
无效缩进,替换为:
有了这个:
这样试试
相关问题 更多 >
编程相关推荐