--- On Mon, 5/25/09, xbmuncher <[email protected]> wrote:


From: xbmuncher <[email protected]>
Subject: [Tutor] Can't print a string, gives me syntax error
To: "[email protected]" <[email protected]>
Date: Monday, May 25, 2009, 5:48 PM


I ran this in IDLE:
>>> t = 'hi'
>>> print t
SyntaxError: invalid syntax (<pyshell#3>, line 1)

I've also tried this as sample.py :
import string
text = 'hello world'
print text


It gives me a syntax error on "print text" line

What's going on? 

I'm guessing, though I'm not that experienced with Python yet, you maybe using 
Python 3.0.  In this new version, you have to include () with print 
statements.  You didn't have to in 2.X versions.  So try:
 
text='Hello Wold'
print (text)
 
That's my guess, if you are using Python 2.x then I don't know:)


      
_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to