end quote help for a newbie

Peter Clark artomishka at yahoo.co.uk
Thu Feb 27 11:30:41 CET 2014


On Thursday, 30 January 2014, 21:27, Peter Clark <artomishka at yahoo.co.uk> wrote:
 
Thank-you.  Please no-one reply to this post.  I just want to put on 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 <zachary.ware+pylist at gmail.com> 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.

On Thu, Jan 30, 2014 at 8:52 AM, Peter Clark <artomishka at 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 at gmail.com> wrote:
>
> On Thu, Jan 30, 2014 at 7:26 AM, Peter Clark <artomishka at 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
>

    

   
Hi, I have just started trying to use python version 3, under windows XP, I have got a simple script (attached) to run as I want in Interpreter mode.  It is saved as a .py file. If I double click on the file the python screen opens and appears to be waiting for input but the cursor just sits there without doing anything but blink. I haven't found any .py program which does anything except open and close the python window, or occasionally accepting input with no response.

I would like to be able to save and run scripts as my usual method of acquiring a new language, but getting python to run a saved script has me beat.  I assume there is something I am missing, or have missed.

As an aside, does the fact that python runs at all indicate that I have C installed?

Thank you in advance for any assistance.

peter clark.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20140227/9e29f164/attachment.html>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: DandD.py
URL: <http://mail.python.org/pipermail/python-list/attachments/20140227/9e29f164/attachment.ksh>


More information about the Python-list mailing list