I have a strange error. Why does it happen?
I write code, but Python shows me the error, but I don’t see that error. I’ve attached the screenshot.
Code
def func(q):
def funct(y):
try:
print(y)
exit()
except:
pass
funct(q)
a=['1','2','3','4','5','6','7']
for x in a:
func(x)
Python
>>> def func(q):
...
File "<stdin>", line 2
^
IndentationError: expected an indented block
>>> def funct(y):
File "<stdin>", line 1
def funct(y):
^
IndentationError: unexpected indent
>>> try:
File "<stdin>", line 1
try:
^
IndentationError: unexpected indent
>>> print(y)
File "<stdin>", line 1
print(y)
^
IndentationError: unexpected indent
>>> exit()
File "<stdin>", line 1
exit()
^
IndentationError: unexpected indent
>>>
>>> except:
File "<stdin>", line 1
except:
^
IndentationError: unexpected indent
>>> pass
File "<stdin>", line 1
pass
^
IndentationError: unexpected indent
>>>
>>> funct(q)
File "<stdin>", line 1
funct(q)
^
IndentationError: unexpected indent
>>>
>>> a=['1','2','3','4','5','6','7']
>>> for x in a:
... func(x)
...
Notepad++: