SyntaxError: multiple statements found while compi

2019-01-29 08:55发布

问题:

this is my code, super simple:

#borders of the bbox
longmax = 15.418483 #longitude top right
longmin = 4.953142 #longitude top left
latmax = 54.869808 #latitude top 
latmin = 47.236219 #latitude bottom

#longitude
longstep = longmax - longmin 
longstepx = longstep / 1000 #longitudal steps the model shall perfom


#latitude
latstep = latmax - longmin
latstepx = latstep / 1000 #latitudal steps the model shall perform

I try to run in it in the Python IDLE (python 3.3) and this errormessage occurs

SyntaxError: multiple statements found while compiling a single statement

Removing the "#" it works just fine.

Whats wrong?!

回答1:

IDLE can only do a single statement at once, i.e. in your case: A single line. So you have to paste in all lines individually and execute them.