Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #69755

Re: How can I parse this correctly?

References <CAJUMiQsoNbNzDgUOkaQxFLGptTqKriD7DcXSeFwwu_-v4TKJKQ@mail.gmail.com> <CAPTjJmqUv_CvcXOgD=reNybyTGNZDGbPaOTdszpJgEvY8bLqoQ@mail.gmail.com> <7E623349-4095-4550-9E2F-D7261C311DBE@gmail.com>
Date 2014-04-06 18:17 +1000
Subject Re: How can I parse this correctly?
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.8942.1396772230.18130.python-list@python.org> (permalink)

Show all headers | View raw


On Sun, Apr 6, 2014 at 4:29 PM, Anthony Papillion <papillion@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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: How can I parse this correctly? Chris Angelico <rosuav@gmail.com> - 2014-04-06 18:17 +1000

csiph-web