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 <artomis...@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+pyl...@gmail.com> wrote: > > On Thu, Jan 30, 2014 at 7:26 AM, Peter Clark <artomis...@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 > -- https://mail.python.org/mailman/listinfo/python-list