Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #22186

Re: help needed to understand an error message.

Date 2012-03-26 15:26 +0200
From Jean-Michel Pichavant <jeanmichel@sequans.com>
Subject Re: help needed to understand an error message.
References <CABWU=Q=vTsjb=DU7kcB71QQ4miSnyapt+_ExeE0Qx094mdK_7w@mail.gmail.com> <CABWU=QkG9riG9-1Cfhe2xoC0jjsw-Xp9S8QUCLBmRN482g2nwA@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.1000.1332768387.3037.python-list@python.org> (permalink)

Show all headers | View raw


Aloke Ghosh wrote:
> Hi,
> I am learning Python and do not have programming experience.
> I was following 
> an exercise from http://learnpythonthehardway.org/book/ex2.html
> and made a mistake in entry :
>
> *Print"I like typing this."* 
>
> and got the following error message:
>
> *In [2]: Print"I like typing this."*
> *------------------------------------------------------------*
> *   File "<ipython console>", line 1*
> *     Print"I like typing this."*
> *                                        ^*
> *SyntaxError: invalid syntax*
>
> I feel the error is in Capital P in print .
> However the error indicated with "*^*" 
> hints at quote at the end of the line.
>
> *Can any one please help me understand this.*
>
> -- 
> A.K.Ghosh
Why don't you just try with a lowercase p ?

The correct syntax would be

print "I like typing this"

or in Python 3:

print ("I like typing this")

Anyway, the hint indicates the last quote because this is the location 
where the python interpreter realizes it won't be able to execute the 
code. You should not worry about that too much.

JM

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: help needed to understand an error message. Jean-Michel Pichavant <jeanmichel@sequans.com> - 2012-03-26 15:26 +0200

csiph-web