这是我的程序,我收到以下提到的错误:
def main():
print "hello"
if __name__=='__main__':
main()
错误
File "hello.py", line 8
main()
^
IndentationError: expected an indented block
请您参考如下方法:
您的缩进已关闭。试试这个:
def main():
print "hello"
if __name__=='__main__':
main()
所有功能 block 以及 if-else 循环 block 都必须缩进一个制表符或 4 个空格(取决于环境)。
if condition :
statements //Look at the indentation here
...
Out-of-block //And here
引用this进行一些解释。
