Syntax problem - cannot solve it by myself
Peter Otten
__peter__ at web.de
Tue Jun 8 17:54:07 EDT 2010
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.
There are small differences between Python 2.x and 3.x.
print(x, end="")
is Python 3 as is the whole book you are reading. I would guess that is
prominently mentioned at the very beginning?
For the examples to work you have to install Python 3.1 with
$ sudo apt-get install python3
and invoke the interpreter with
$ python3
Good luck with your efforts!
Peter
More information about the Python-list
mailing list