Absolute beginner

L

lucbonne

Hi there,
I installed python 3.1 on Windows Vista PC.
Am an absolute beginner with Python.
This is my problem :

In Idle :

Python 3.1.1 (r311:74483, Aug 17 2009, 17:02:12) [MSC v.1500 32 bit
(Intel)] on win32
Type "copyright", "credits" or "license()" for more information.SyntaxError: invalid syntax (<pyshell#0>, line 1)

At a dos-prompt :

Python 3.1.1 (r311:74483, Aug 17 2009, 17:02:12) [MSC v.1500 32 bit
(Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information. File "<stdin>", line 1
print "Hello"
^
SyntaxError: invalid syntax
Looks stupid, probably is, but I cannot figure it out.

Thanks for any help !

Lucky
 
K

Krister Svanlund

In Python 3 the syntax for print has changed to print() so just put
braces around the string and you'r good to go!

Hi there,
I installed python 3.1 on Windows Vista PC.
Am an absolute beginner with Python.
This is my problem :

In Idle :

Python 3.1.1 (r311:74483, Aug 17 2009, 17:02:12) [MSC v.1500 32 bit
(Intel)] on win32
Type "copyright", "credits" or "license()" for more information.SyntaxError: invalid syntax (<pyshell#0>, line 1)

At a dos-prompt :

Python 3.1.1 (r311:74483, Aug 17 2009, 17:02:12) [MSC v.1500 32 bit
(Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information. File "<stdin>", line 1
   print "Hello"
               ^
SyntaxError: invalid syntax
Looks stupid, probably is, but I cannot figure it out.

Thanks for any help !

Lucky
 
S

Simon Brunning

2009/12/30 said:
At a dos-prompt :

Python 3.1.1 (r311:74483, Aug 17 2009, 17:02:12) [MSC v.1500 32 bit
(Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information. File "<stdin>", line 1
   print "Hello"
               ^
SyntaxError: invalid syntax

You are using Python 2 syntax, but a Python 3 interpreter. So, either
download an earlier version of Python, or use a tutorial which covers
Python 3.

Rather unlucky timing, really - Python 3 is the first non-trivially
backward incompatible version for a very long time - at least a decade
and a half.
 
L

Luc

Thanks Krister !
Should have read specific 3.1 documentation :-( .

Regards, Luc

In Python 3 the syntax for print has changed to print() so just put
braces around the string and you'r good to go!

Hi there,
I installed python 3.1 on Windows Vista PC.
Am an absolute beginner with Python.
This is my problem :
In Idle :
Python 3.1.1 (r311:74483, Aug 17 2009, 17:02:12) [MSC v.1500 32 bit
(Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
print "Hello"
SyntaxError: invalid syntax (<pyshell#0>, line 1)
At a dos-prompt :
Python 3.1.1 (r311:74483, Aug 17 2009, 17:02:12) [MSC v.1500 32 bit
(Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
print "Hello"
 File "<stdin>", line 1
   print "Hello"
               ^
SyntaxError: invalid syntax
Looks stupid, probably is, but I cannot figure it out.
Thanks for any help !
 
L

Luc

Also thanks Ben and Simon for your help !

Thanks Krister !
Should have read specific 3.1 documentation :-(  .

Regards,  Luc

In Python 3 the syntax for print has changed to print() so just put
braces around the string and you'r good to go!
Hi there,
I installed python 3.1 on Windows Vista PC.
Am an absolute beginner with Python.
This is my problem :
In Idle :
Python 3.1.1 (r311:74483, Aug 17 2009, 17:02:12) [MSC v.1500 32 bit
(Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
print "Hello"
SyntaxError: invalid syntax (<pyshell#0>, line 1)
At a dos-prompt :
Python 3.1.1 (r311:74483, Aug 17 2009, 17:02:12) [MSC v.1500 32 bit
(Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information..
print "Hello"
 File "<stdin>", line 1
   print "Hello"
               ^
SyntaxError: invalid syntax
Looks stupid, probably is, but I cannot figure it out.
Thanks for any help !
Lucky
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,479
Members
44,900
Latest member
Nell636132

Latest Threads

Top