On 06/09/10 07:44, Deadly Dirk 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. 

That print function is Python 3.x syntax. In Python 2.x, print is a
statement, not a function and uses completely different syntax.

You can, though, add this switch at the top of your python code:

from __future__ import print_statement

to use the new print syntax in python 2.x

Or, you could download and install Python 3.x.

Or, you could find a book that discusses Python 2.x.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to