Python 2.7 IndentationError -


i getting indentationerror when trying run program in python interpreter:

 line 127     global map          ^ indentationerror: expected indented block 

i using python version 2.7

what's wrong following code?:

def make_map(): global map 

python expects 4 spaces or tab indent , align code - similar java expecting curly {} brackets start of loop, method or class etc.

def some_function(): somecode morecode ... 

should formatted as

def some_function():     somecode     morecode     ... 

it appears code throws exception on line 127, check , indent code required.

def some_code():     in range(1, some_value):         some_method()          if need_more_indent:             indent_code()          do_this_after_indent_code()      this_runs_after_for_loop()      return 'lol' 

Comments

Popular posts from this blog

java - unable show chart in xls document using jasper reports -

javascript - How to change image src on success AJAX -

java.lang.RuntimeException: Could not generate dummy secret at sun.security.ssl.RSAClientKeyExchange.<init> -