I am going through the book mentioned in the subject line, and I have found a
couple of things that don't seem to work the way the author shows in the book.
So, either I am doing something wrong, or what he is saying isn't quite right.
I am using Python 2.7.1 on Mac OS X Leopard.
The first thing is what he has for getting keyboard input (this is non-GUI
stuff).
Several times he does something like this:
x = input('type something: ")
But when I do the above and type something in, I get an error message saying
that whatever I have typed in response to the above input() command, is an
undefined name, unless I put it in quotes when I type it. I did a bit of
poking around on the net and found out that input() actually appears to treat
whatever is typed as an actual python command, i.e. as if it was being
"eval"ed. If this is the case...why does he describe the usage this way in
his book?
On the other hand, raw_input() works just as exected, is it a typo? Seems like
kind of a bad error to have in a Python book for beginners.
And I just found another one that doesn't appear to work as he describes.
print("some text here", end = ' ')
He says this is supposed to control the end character on a print statement,
allowing one to choose what the last character printed will be, other than a
newline. But when I try it, I get a syntax error on the "=" after "end".
So is this not a valid command format? Or is he using perhaps an earlier
version of python? The copyright date on the book is 2010, and it is the 3rd
Edition of the book.
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor