You are not logged in.

#1 2012-02-20 11:57:33

sipik
Member
Registered: 2011-05-16
Posts: 23

[SOLVED] python SyntaxError

Hi all!
Trying to start learning python and having the following problem:

$ python
Python 3.2.2 (default, Nov 21 2011, 16:50:59) 
[GCC 4.6.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> print "hello world"
  File "<stdin>", line 1
    print "hello world"
                      ^
SyntaxError: invalid syntax
>>>

The same happens if I run /usr/bin/python3 instead of the symlink.

Searching the forum for this problem was not succesfull, therefore I would like to ask for help to fix this.

Thanks!

Last edited by sipik (2012-02-20 12:53:59)

Offline

#2 2012-02-20 12:03:34

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,365
Website

Re: [SOLVED] python SyntaxError

That is python2 code...

Offline

#3 2012-02-20 12:05:14

Gcool
Member
Registered: 2011-08-16
Posts: 1,456

Re: [SOLVED] python SyntaxError


Burninate!

Offline

#4 2012-02-20 12:21:13

linux-ka
Member
From: ADL
Registered: 2010-05-07
Posts: 232

Re: [SOLVED] python SyntaxError

use python2 instead of python, which is python 3.x . There are some syntax changes between python 2.x and 3.x

Offline

#5 2012-02-20 12:48:19

sipik
Member
Registered: 2011-05-16
Posts: 23

Re: [SOLVED] python SyntaxError

ok i must have started with a python2 tutorial... sorry for my ignorance

thanks a lot!

Offline

#6 2012-02-20 13:49:12

bernarcher
Forum Fellow
From: Germany
Registered: 2009-02-17
Posts: 2,281

Re: [SOLVED] python SyntaxError

Wrong forum. Moved to Programming & Scripting.


To know or not to know ...
... the questions remain forever.

Offline

#7 2012-02-20 18:10:07

elp
Member
Registered: 2007-04-10
Posts: 27

Re: [SOLVED] python SyntaxError

print ("Hello Arch Linux") will do the trick in 3x

Offline

Board footer

Powered by FluxBB