How can I parse this correctly?

Chris Angelico rosuav at gmail.com
Sun Apr 6 04:17:01 EDT 2014


On Sun, Apr 6, 2014 at 4:29 PM, Anthony Papillion <papillion at gmail.com> wrote:
> No particular reason at all. I've Bern dabbling in Python for the last bit
> and am just writing code based on the samples or examples I'm finding.  What
> was the tipoff that this was not Python 3? Would there be a large difference
> in this code if it was Python 3?

The tip-off was that you have no parentheses around print's arguments.
Behold the vast difference that told me which it was:

# Python 2: print is a statement
print int(row['YEAR'])

# Python 3: print is a function
print(int(row['YEAR']))

So incredibly different :) But it's enough to show that you're on Python 2.

ChrisA



More information about the Python-list mailing list