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


Groups > comp.lang.python > #69755

Re: How can I parse this correctly?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder7.xlned.com!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.047
X-Spam-Evidence '*H*': 0.91; '*S*': 0.00; 'vast': 0.09; 'subject:How': 0.10; 'cc:addr:python-list': 0.11; 'python': 0.11; 'bern': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'parentheses': 0.16; 'all.': 0.16; 'wrote:': 0.18; 'bit': 0.19; 'examples': 0.20; 'cc:addr:python.org': 0.22; 'print': 0.22; 'cc:2**0': 0.24; "i've": 0.25; 'header:In-Reply- To:1': 0.27; 'function': 0.29; 'statement': 0.30; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; 'code': 0.31; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'subject:?': 0.36; 'pm,': 0.38; 'subject:can': 0.39; 'enough': 0.39; 'skip:p 20': 0.39; "you're": 0.61; 'show': 0.63; 'different': 0.65; 'subject:this': 0.83; '4:29': 0.84; 'was:': 0.91; 'to:none': 0.92; 'incredibly': 0.96
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=PIQL2FXlPsiXGS6xYXLz8+ixdDwYQLMoiHvb4BsSpAQ=; b=pgtN0C1JXDoPBbA+PnVM8WkpPNB43BSlPYTf45SrwIRN5cjAdKwErwXMnScO8fJCCD lMjVgioJ/W7EXFzSCKBowSbDSQqovvZKChcpz1P/vyuCUWYBZ4Wphr7qm3XW/ANz+2FY dCDPUjJLl4QeynQTSpMa9xbpjhUlmLg59d6Plp9VelwRtTaaaGZoyOwpVz4Ri/nQUhH9 jjCzlKt//papPLad4vKXLKasHxdz8ajPTn1r7l6TGj6kUC/Df1nphAbiV0fBtvX1OzMO Wp9gErL8EvUqxVrhP2V6gFALMA+IrJyguyoWc3JpCeQEUUuqtd2ZfaE/LTiTNY41rODQ jMew==
MIME-Version 1.0
X-Received by 10.68.196.137 with SMTP id im9mr1452164pbc.105.1396772222242; Sun, 06 Apr 2014 01:17:02 -0700 (PDT)
In-Reply-To <7E623349-4095-4550-9E2F-D7261C311DBE@gmail.com>
References <CAJUMiQsoNbNzDgUOkaQxFLGptTqKriD7DcXSeFwwu_-v4TKJKQ@mail.gmail.com> <CAPTjJmqUv_CvcXOgD=reNybyTGNZDGbPaOTdszpJgEvY8bLqoQ@mail.gmail.com> <7E623349-4095-4550-9E2F-D7261C311DBE@gmail.com>
Date Sun, 6 Apr 2014 18:17:01 +1000
Subject Re: How can I parse this correctly?
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.8942.1396772230.18130.python-list@python.org> (permalink)
Lines 18
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1396772230 news.xs4all.nl 2847 [2001:888:2000:d::a6]:37918
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:69755

Show key headers only | 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