Ahmad syr
Ahmad syr

Reputation: 1

IndentationError in python main files

I am a newbie in python while I execute Hello World code on sublime text 2 I face this error

    Traceback (most recent call last):
  File "G:\Python32\lib\runpy.py", line 142, in _run_module_as_main
    mod_name, loader, code, fname = _get_main_module_details()
  File "G:\Python32\lib\runpy.py", line 185, in _get_main_module_details
    return _get_module_details(main_name)
  File "G:\Python32\lib\runpy.py", line 114, in _get_module_details
    code = loader.get_code(mod_name)
  File "G:\Python32\lib\pkgutil.py", line 281, in get_code
    self.code = compile(source, self.filename, 'exec')
  File "G:\Python32\__main__.py", line 2
    |
    ^
IndentationError: unexpected indent
[Finished in 0.1s with exit code 1]

Please help me

Upvotes: 0

Views: 1206

Answers (2)

Paras
Paras

Reputation: 3235

indentation is Python’s way of grouping statements. At the interactive prompt, you have to type a tab or space(s) for each indented line. When a compound statement is entered interactively, it must be followed by a blank line to indicate completion (since the parser cannot guess when you have typed the last line). Note that each line within a basic block must be indented by the same amount.

Upvotes: 0

0xc0de
0xc0de

Reputation: 8297

On line 2 of your program, the code indentation isn't correct.

Upvotes: 3

Related Questions