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


Groups > comp.lang.python > #22405 > unrolled thread

Re: help needed to understand an error message.

Started by"J. Cliff Dyer" <jcd@sdf.lonestar.org>
First post2012-03-30 21:51 -0400
Last post2012-03-30 21:51 -0400
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: help needed to understand an error message. "J. Cliff Dyer" <jcd@sdf.lonestar.org> - 2012-03-30 21:51 -0400

#22405 — Re: help needed to understand an error message.

From"J. Cliff Dyer" <jcd@sdf.lonestar.org>
Date2012-03-30 21:51 -0400
SubjectRe: help needed to understand an error message.
Message-ID<mailman.1165.1333158726.3037.python-list@python.org>
So the problem is that python doesn't know what you're trying to do.  It
doesn't know that you meant to say "print."  When the parser is looking
at the word Print, it assumes you are referencing an object named Print,
which is completely legal.  It's only once you've created the next
token, a string literal, that the parser discovers the error: you can't
have a string literal following a variable.  

*You* think your error is that you misspelled "print."  The parser
thinks your error is trying to put a string literal next to a variable.

Cheers,
Cliff


On Mon, 2012-03-26 at 18:22 +0530, 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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web