当前位置:   article > 正文

Python报错及解决办法一_indentationerror: expected an indented block after

indentationerror: expected an indented block after 'for' statement on line 1

问题一:

C:\Users\asus>print("Hello World")

无法初始化设备 PRN

解决办法:先执行python解释器,再执行python代码

C:\Users\asus>python

Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug  1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)] on win32

Type "help", "copyright", "credits" or "license" for more information.

>>> print("Hello World!")

Hello World!

>>>

问题二:

>>> for i in (0,1,2,3,4,5):

... print(i)

  File "<stdin>", line 2

    print(i)

    ^

IndentationError: expected an indented block after 'for' statement on line 1

解决办法:第二行在print前敲入一个TAB建

>>> for i in (0,1,2,3,4,5):

...     print(i)

...

0

1

2

3

4

5

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/2023面试高手/article/detail/522662
推荐阅读
相关标签
  

闽ICP备14008679号