Copyright (C) 2000-2012 |
GNU Info (python2.1-tut.info)Syntax ErrorsSyntax Errors ============= Syntax errors, also known as parsing errors, are perhaps the most common kind of complaint you get while you are still learning Python: >>> while 1 print 'Hello world' File "<stdin>", line 1 while 1 print 'Hello world' ^ SyntaxError: invalid syntax The parser repeats the offending line and displays a little `arrow' pointing at the earliest point in the line where the error was detected. The error is caused by (or at least detected at) the token _preceding_ the arrow: in the example, the error is detected at the keyword `print', since a colon (`:') is missing before it. File name and line number are printed so you know where to look in case the input came from a script. automatically generated by info2www version 1.2.2.9 |