"Unindent does not match any outer indentation level" 在 Python
"Unindent does not match any outer indentation level" in Python
我有一些 Python 代码没有 运行。错误消息说:
unindent does not match any outer indentation level
def main1():
password = "LPPJJAS"
user_input = raw_input('Please Enter Password: ')
if user_input == password:
print 'All distances have been split so one pixel is equal to two centimetres'
time.sleep(1)
elif user_input != password:
print 'Incorrect Password, terminating... \n'
exit("pow")
if __name__ == "__main__":
main1()`
在第 5 行之前多了一个 space - print 'All distances...
。 Python 期望每一行的缩进相等。 (通常为 4 space 秒。)
password = "LPPJJAS"
user_input = raw_input('Please Enter Password: ')
if user_input == password:
print 'All distances have been split so one pixel is equal to two centimetres'
time.sleep(1)
elif user_input != password:
print 'Incorrect Password, terminating... \n'
exit("pow")
我有一些 Python 代码没有 运行。错误消息说:
unindent does not match any outer indentation level
def main1():
password = "LPPJJAS"
user_input = raw_input('Please Enter Password: ')
if user_input == password:
print 'All distances have been split so one pixel is equal to two centimetres'
time.sleep(1)
elif user_input != password:
print 'Incorrect Password, terminating... \n'
exit("pow")
if __name__ == "__main__":
main1()`
在第 5 行之前多了一个 space - print 'All distances...
。 Python 期望每一行的缩进相等。 (通常为 4 space 秒。)
password = "LPPJJAS"
user_input = raw_input('Please Enter Password: ')
if user_input == password:
print 'All distances have been split so one pixel is equal to two centimetres'
time.sleep(1)
elif user_input != password:
print 'Incorrect Password, terminating... \n'
exit("pow")