[TriZPUG] Reminder: TriZPUG October 2011 Meeting: PLY
kmtracey at gmail.com
Fri Oct 28 03:49:01 CEST 2011
I enjoyed the meeting, thanks!
On that example, that didn't work, apparently it's written for Python 3.
s = input('calc > ') # Use raw_input on Python 2
needs to be:
s = raw_input('calc > ') # Use raw_input on Python 2
(which the comment clearly says but none of us noticed). input() on Python 2
actually evaluates(!) the user's input and returns the result (
http://docs.python.org/library/functions.html#input). So entering 5+3 was
feeding the int 8 into the parser, which confused it since it since the
parser expects string input.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the TriZPUG