syntax error : first python program

Ben Finney ben+python at benfinney.id.au
Wed Dec 23 00:25:27 EST 2009


pradeep <bansal.pradeep at gmail.com> writes:

> #!/usr/bin/env python
>     name = "blah"
>     print name

These two lines are indented, but are not inside a block.

> bash# /usr/bin/python sample.py
>   File "sample.py", line 2
>     name = "blah"
>     ^
> SyntaxError: invalid syntax

Indentation is syntax in Python.

> Any one knows , whats the syntax error here?

You would do well to work through all the exercises in the Python
tutorial <URL:http://docs.python.org/tutorial/> to get a good grounding
in all the basics like this.

-- 
 \            “Human reason is snatching everything to itself, leaving |
  `\                     nothing for faith.” —Saint Bernard, 1090–1153 |
_o__)                                                                  |
Ben Finney



More information about the Python-list mailing list