下面是代碼:IndentationError預期的縮進塊
def myfirst_yoursecond(p,q):
a = p.find(" ")
b = q.find(" ")
str_p = p[0:a]
str_q = p[b+1:]
if str_p == str_q:
result = True
else:
result = False
return result
以下是錯誤:
Traceback (most recent call last):
File "vm_main.py", line 26, in <module>
import main
File "/tmp/vmuser_ssgopfskde/main.py", line 22
result = False
^
IndentationError: expected an indented block
這有什麼錯我的代碼?
謝謝!有用! Python不支持這兩種縮進。這聽起來很奇怪。 – Sam 2012-04-20 00:49:17
它實際上支持8-space選項卡,但是堅持使用空格會更好,尤其是當您的代碼在編輯器和系統之間移動時(您應該期待它。) – zigg 2012-04-20 00:56:04
對不起。我已將其更改爲q [b + 1:]。你真的很樂意幫助我。 – Sam 2012-04-20 01:27:26