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


Groups > comp.lang.python > #65023

Re: end quote help for a newbie

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <zachary.ware@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.005
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'python,': 0.02; 'tutorial': 0.03; 'win32': 0.03; 'syntax': 0.04; 'interpreter': 0.05; 'lines,': 0.07; 'mouse': 0.07; 'subject:help': 0.08; 'key.': 0.09; 'literal': 0.09; 'option,': 0.09; 'python': 0.11; 'jan': 0.12; '2.7': 0.14; 'changes': 0.15; 'windows': 0.15; '"python': 0.16; "'''": 0.16; "'input'": 0.16; '(note': 0.16; 'clark': 0.16; 'dump': 0.16; 'effect,': 0.16; 'function),': 0.16; 'highlight': 0.16; 'instead:': 0.16; 'list"': 0.16; 'quotes)': 0.16; 'relates': 0.16; 'syntaxerror:': 0.16; 'thursday,': 0.16; 'sender:addr:gmail.com': 0.17; 'wrote:': 0.18; 'bit': 0.19; 'trying': 0.19; 'thu,': 0.19; 'written': 0.21; 'seems': 0.21; 'command': 0.22; '>>>': 0.22; 'select': 0.22; '(in': 0.22; 'to:name:python-list@python.org': 0.22; 'print': 0.22; 'keyboard': 0.24; 'initial': 0.24; 'versions': 0.24; 'looks': 0.24; 'cc:2**0': 0.24; 'downloaded': 0.26; 'header:In-Reply-To:1': 0.27; 'tried': 0.27; 'function': 0.29; 'am,': 0.29; 'character': 0.29; "doesn't": 0.30; 'statement': 0.30; 'message-id:@mail.gmail.com': 0.30; 'skip:( 20': 0.30; '>>>>': 0.31; 'flags': 0.31; 'quotes': 0.31; 'subject:end': 0.31; 'terminate': 0.31; 'file': 0.32; 'probably': 0.32; 'checked': 0.32; 'figure': 0.32; 'open': 0.33; 'url:python': 0.33; 'community': 0.33; 'copying': 0.34; 'screen': 0.34; 'anywhere': 0.35; 'definition': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'version': 0.36; 'format.': 0.36; 'transition': 0.36; 'url:org': 0.36; 'should': 0.36; 'changing': 0.37; 'january': 0.37; 'list.': 0.37; 'thank': 0.38; 'nov': 0.38; 'to:addr:python-list': 0.38; 'list,': 0.38; 'rather': 0.38; 'that,': 0.38; 'anything': 0.39; '(from': 0.39; 'quote': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.39; 'space': 0.40; 'how': 0.40; 'easy': 0.60; 'enclosed': 0.60; 'most': 0.60; 'hope': 0.61; 'url:3': 0.61; 'entire': 0.61; "you're": 0.61; 'first': 0.61; "you've": 0.63; 'choose': 0.64; 'more': 0.64; 'different': 0.65; 'taking': 0.65; '30,': 0.65; 'here': 0.66; 'reply': 0.66; 'between': 0.67; '19th': 0.68; 'invalid': 0.68; 'statement,': 0.68; 'containing': 0.69; 'fact,': 0.69; 'to,': 0.72; 'click': 0.77; '\xe2\x80\x93': 0.77; 'ending': 0.78; '2014,': 0.84; 'cc:addr:yahoo.co.uk': 0.84; 'out!': 0.84; 'pasting': 0.84; 'quote,': 0.84; '2013,': 0.91; 'ware': 0.91; 'from.': 0.93; 'confirms': 0.95; 'directly.': 0.95; 'online,': 0.96
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type:content-transfer-encoding; bh=h/lCIy+QAh/MwZVzjgpi4kED+xRdAojG5Of5cKUML2I=; b=Kq/ahrAo3wdEP1CUcv5umqeP7LfapOvFtx0aAZiSaypGTdo9OsUoSjCCh551TUoLrc PV7eQwjun8jrRRdhzpMsOSZ7RAHB828kWnzgA+DlGwFuWOBQC9n+NWroLlP3tyw80Vf9 2ciEU507oZ3avn02l5f9RburSb4VChMEO1V9kq3h6cfYdMMVYoeRbVv4PHLodw8eqVTv 3s1FREB8Q54npxf+oLJlKALNc5kHkIQl/UyHjOu9/odTGcW7T06zTnLQotZT0jd38oRj dhs0+92i52R3pG6FKZYmyb8lS8r8i9tZRw8GqPIMGGiJldlFYNXHw6ZdQaPyL9OzraQ1 wKhw==
X-Received by 10.205.21.193 with SMTP id qt1mr84689bkb.53.1391095909094; Thu, 30 Jan 2014 07:31:49 -0800 (PST)
MIME-Version 1.0
Sender zachary.ware@gmail.com
In-Reply-To <1391093552.89290.YahooMailNeo@web133104.mail.ir2.yahoo.com>
References <1391088376.73476.YahooMailNeo@web133103.mail.ir2.yahoo.com> <CAKJDb-PpPiFnG7=jmrUGnXZPqkdHWHFCxe9N6Dct5gbrQT5sdQ@mail.gmail.com> <1391093552.89290.YahooMailNeo@web133104.mail.ir2.yahoo.com>
From Zachary Ware <zachary.ware+pylist@gmail.com>
Date Thu, 30 Jan 2014 09:31:28 -0600
X-Google-Sender-Auth BeC5wqX0ZwMKUTONbTnmxEtM8C4
Subject Re: end quote help for a newbie
To "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
Cc Peter Clark <artomishka@yahoo.co.uk>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.6149.1391095916.18130.python-list@python.org> (permalink)
Lines 114
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1391095916 news.xs4all.nl 2833 [2001:888:2000:d::a6]:43109
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:65023

Show key headers only | View raw


Please reply to the list, rather than to me directly.  You can use
"Reply to List" if you have that option, or "Reply to All" to make
sure you include the list.

On Thu, Jan 30, 2014 at 8:52 AM, Peter Clark <artomishka@yahoo.co.uk> wrote:
> I do not know how to dump the screen - it will not let me select anything
> with the mouse cursor, so here is my (typed in) reproduction:

Since it looks like you're probably using Windows Command Prompt, you
can right click anywhere in that window, click "Mark", and highlight a
rectangle containing what you want and hit the Enter key.  Note that
it doesn't go by lines, only the rectangle you highlight will be
copied! (Yes, it is horribly annoying :)

Thank you for taking the time to type it all out!

> Python 3.3.3 (v3.3.3:c3896275c0f6, Nov 18 2013, 21:18:40)  [MSC v.1600 32
> bit (In
> tel) on win32
> Type "help", "copyright", "credits" or "license" for more information.
>>>> print "xyz"
>      File "(stdin)", line 1
>         print "xyz"
>                        ^
> SyntaxError: invalid syntax

This right here confirms what I thought: you're using Python 3 with a
Python 2 tutorial.  'print' in Python 3 is a function just like
'input' or 'open', so you have to use it like this instead:

   >>> print("xyz")
   xyz



>>>> print '''xyz"  . . .'''
>      File "(stdin)", line 1
>         print '''xyz'''
>                          ^
> SyntaxError: invalid syntax
>>>> print '''xyz"  . . .''                    (note - not appearing on
>>>> screen - this is 2 single quotes)
> ... '''
>     File "(stdin)", line 2
>         '''
>          ^
> SyntaxError: invalid syntax
>>>>
>
> I do not see anywhere a definition of which version the tutorial relates to,
> but I downloaded it from the Python site on 19th January 2014.

The Python website provides docs for every current version of Python,
and the community is currently in the midst of a very long transition
from version 2.7 to 3.x, so both versions are considered "current".
In fact, most links to the Python documentation will link to the 2.7
version to maintain compatibility.  Here's a link to the Python 3
version of the tutorial, which should work much better for you!
http://docs.python.org/3/tutorial/

You can also find the docs in your Python installation: find Python
3.3 in your start menu, and choose "Python Manuals".  This will open
the same docs as are found online, in standard Windows help file
format.  Click the "Tutorial" link on the first page of that, and you
should have the right tutorial to work from.

Hope this helps, and welcome to Python!

--

Zach

>
> peter.
>
> On Thursday, 30 January 2014, 16:13, Zachary Ware
> <zachary.ware+pylist@gmail.com> wrote:
>
> On Thu, Jan 30, 2014 at 7:26 AM, Peter Clark <artomishka@yahoo.co.uk> wrote:
>
>> There is probably an easy solution to this – but I have not found it.
>>
>> Trying to terminate a literal in a print statement (from the tutorial).
>>
>> The literal should be enclosed in double quotes “ “
>>
>> the initial double quote seems to be OK (if I use a different character it
>> flags it) but the ending is flagged as invalid syntax.  I have tried
>> changing my keyboard from UK to USA, without any effect, and tried adding
>> a
>> space after the final double quote,
>
>
> Which version of Python are you using?  Make sure you're using the
> same version of interpreter and tutorial.  'print' was one of the big
> changes between Python 2 and Python 3 (in Python 2 it was a statement,
> while in Python 3 it is a function), so a tutorial written with Python
> 2 in mind will have some issues if you're using Python 3.
>
> If you've already checked that, try copying and pasting your entire
> interpreter session into a reply here, and we'll be more able to
> figure out what's going on.
>
> Hope this helps,
>
> --
> Zach
>

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


Thread

Re: end quote help for a newbie Zachary Ware <zachary.ware+pylist@gmail.com> - 2014-01-30 09:31 -0600

csiph-web