python version 2.7.10
When I was trying to draw a set of mandelobro, I was creating the following program.
File "mandelplot.py", line 33
List.append(z)
^
IndentationError—unindent does not match any outer indication level
The error will be printed.
I can't find out what's wrong with it even when I look it up.
Are you missing something simple?
class Mandel (object):
def mandelblot(self,c,K,LOOPMAX):
# return the number of loops that have been diverted to
List = [ ]
n = 0
z = 0.0 + (0.0 * 1j)
while(n<LOOPMAX and abs(z)<K)US>:
z=z**2+c
List.append(z)
if(n>4):
List.pop(0)
equal1 = List[0] - List[4]
event2 = List[0] - List[3]
if(abs(val1)<10e-5 or abs(val2)<10e-5):
break
n + = 1
return n
Check again to see if there is a mix of tab and space characters. When running Python interpreter, you can easily detect this type of error by specifying the -t
or -tt
options.
Also, we recommend using a text editor that allows you to visually distinguish tabs/spaces.
For your information, PEP-8 recommends using the space, which defines the coding conventions for Python standard libraries.If you are not particular about it, you should follow PEP-8.
Maybe that line has a mix of tabs and spaces.
thPython 初心Error message often sent by beginners
http://blog.bakorer.com/archives/50555189.html
© 2024 OneMinuteCode. All rights reserved.