Syntax error for print

jsm4321 at gmail.com jsm4321 at gmail.com
Thu Dec 25 20:00:41 CET 2008


Thanks Bearophile.

I should have used a tutorial for Python 3.0

I was reading tutorial for Python 2.5

On Dec 25, 11:58 pm, bearophileH... at lycos.com wrote:
> On Dec 25, 7:53 pm, jsm4... at gmail.com wrote:
>
>
>
> > IDLE 3.0>>> print "hello"
>
> > SyntaxError: invalid syntax (<pyshell#0>, line 1)>>> 3+3
> > 6
> > >>> var = 4
> > >>> var = var*4
> > >>> print var
>
> > SyntaxError: invalid syntax (<pyshell#5>, line 1)
>
> > Any idea on why I am getting this error.
> > I have just started learning python and I am stuck at first thing
> > itself.
> > Any help would be greatly appreciated.
>
> > Thanks,
> > Jeetu Sahil
>
> The print of Python3 needs parentheses:
>
> print(var)
>
> Older Python versions are different.
>
> Bye,
> bearophile




More information about the Python-list mailing list