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


Groups > comp.lang.python > #69762

Re: How can I parse this correctly?

From Mark Lawrence <breamoreboy@yahoo.co.uk>
Subject Re: How can I parse this correctly?
Date 2014-04-06 12:32 +0100
References <CAJUMiQsoNbNzDgUOkaQxFLGptTqKriD7DcXSeFwwu_-v4TKJKQ@mail.gmail.com> <CAPTjJmqUv_CvcXOgD=reNybyTGNZDGbPaOTdszpJgEvY8bLqoQ@mail.gmail.com> <7E623349-4095-4550-9E2F-D7261C311DBE@gmail.com> <CAPTjJmo_ZRaiqwaJGwfamcktOc9GAmz=Dno82kW_=ZQgRYZ5_g@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.8948.1396783966.18130.python-list@python.org> (permalink)

Show all headers | View raw


On 06/04/2014 09:17, Chris Angelico wrote:
> 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
>

I'd recommend using this import statement in Python 2 so you get used to 
print being a function.

from __future__ import print_function

-- 
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.

Mark Lawrence

---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com

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


Thread

Re: How can I parse this correctly? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-04-06 12:32 +0100

csiph-web