Syntax problem - cannot solve it by myself

fred lore fred.lore at gmail.com
Tue Jun 8 17:55:15 EDT 2010


On 8 juin, 23:44, Deadly Dirk <d... at plfn.invalid> wrote:
> I am a total beginner with Python. I am reading a book ("The Quick Python
> Book", 2nd edition, by Vernon Ceder) which tells me that print function
> takes end="" argument not to print newline character. I tried and here is
> what happens:
>
> >>> print(x)
> abc
> >>> print(x,end="")
>
>   File "<stdin>", line 1
>     print(x,end="")
>                ^
> SyntaxError: invalid syntax
>
> What does the error message mean? I am using Python 2.6.5 on Ubuntu 9.10.


in python 2.6.5, print is a keyword and this syntax is not allowed
print becomes a real function with few keywords arguments like "end"
only since python 3.0

Daniel



More information about the Python-list mailing list