Re: end quote help for a newbie

Discussion in 'Python' started by Peter Clark, Jan 30, 2014.

  1. Peter Clark

    Peter Clark Guest

    Thank-you.  Please no-one reply to this post.  I just want to puton record my complete p-offed-ness, that having spent 10 days sorting out and hypertexting a library of documentation, I now have to start all over.

    Please do not respond, I am sure it is all my fault.

    Please do not respond - it will only prolong the agony.

    Long live the Norwegian blue.

    peter



    On Thursday, 30 January 2014, 17:31, Zachary Ware <> wrote:

    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.

    OnThu, Jan 30, 2014 at 8:52 AM, Peter Clark <> 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
    canright 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
    > <> wrote:
    >
    > On Thu, Jan 30, 2014 at 7:26 AM, Peter Clark <> 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, andtried 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
    >
     
    Peter Clark, Jan 30, 2014
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Peter Clark

    end quote help for a newbie

    Peter Clark, Jan 30, 2014, in forum: Python
    Replies:
    1
    Views:
    56
    Steven D'Aprano
    Jan 30, 2014
  2. MRAB
    Replies:
    0
    Views:
    51
  3. Skip Montanaro

    Re: end quote help for a newbie

    Skip Montanaro, Jan 30, 2014, in forum: Python
    Replies:
    0
    Views:
    58
    Skip Montanaro
    Jan 30, 2014
  4. Zachary Ware

    Re: end quote help for a newbie

    Zachary Ware, Jan 30, 2014, in forum: Python
    Replies:
    0
    Views:
    81
    Zachary Ware
    Jan 30, 2014
  5. Peter Clark

    Re: end quote help for a newbie

    Peter Clark, Feb 27, 2014, in forum: Python
    Replies:
    0
    Views:
    79
    Peter Clark
    Feb 27, 2014
Loading...

Share This Page