3-7.python函数的基础调用之异常1(IndentationError: unindent does not match any outer indentation level)

代码:

结果:

PS E:\30.Study\30.自动化测试\99.零基础入门 Python Web 自动化测试\10.seleniumCodePractice> & "C:/Program Files/Python38/python.exe" "e:/30.Study/30.自动化测试/99.零基础入门 Python Web 自动化测试/10.seleniumCodePractice/202006/python_function.py"
  File "e:/30.Study/30.自动化测试/99.零基础入门 Python Web 自动化测试/10.seleniumCodePractice/202006/python_function.py", line 8
    people(10)
             ^
IndentationError: unindent does not match any outer indentation level
PS E:\30.Study\30.自动化测试\99.零基础入门 Python Web 自动化测试\10.seleniumCodePractice>

原因分析:

python对缩进有严格的要求,既然提示line 8有问题,说明在line 8缩进有问题,原来在 people(10)前面有一个空格

对应方法:

people(10)前面的空格删除即可,下图:

补充:

转自:https://blog.csdn.net/IAMoldpan/article/details/78347346

IAMoldpan总结了以下几种常见的缩进错误:

1、代码前后缩进量不一致

2、代码前后缩进符号不一致

3、tab与space混用

猜你喜欢

转载自www.cnblogs.com/hadas/p/13167582.html
今日推荐