[Tutor] IDLE colon = syntax error

Dave Angel davea at ieee.org
Wed Sep 16 23:49:15 CEST 2009


Carnell, James E wrote:
> I searched through archives and wasn't able to find the solution.
>
> Using IDLE, python 3, Ubuntu (default installations).
>
> Using command line:
>
> 	> if 1 == 1:
> 		print "equal"
> 	> equal
>
> Using IDLE:
>
> 	>if 1 == 1:
> 		print "equal"
> 	>SyntaxError: invalid syntax line 2
>
> Just for kicks in IDLE:
> 	
> 	>ord(':')  #see if it gives me some wack ASCII code
> 	>58
>
> Oh well, I imagine this is easy, but I just don't know... (what I get
> for using a new computer and OS today)
>
>   
In Python 3, print is not a statement, but  a function.  So you need 
parentheses around its argument(s).

The first time, you were presumably using a 2.x Python.  You can check with
   import sys
   print (sys.version)

Incidentally, 3.1 is much more stable than 3.0.  And most of us do also 
keep a 2.x around, for all those things that aren't ready for 3.x

DaveA



More information about the Tutor mailing list