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


Groups > comp.lang.python > #98699

Re: new to python, help please !!

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Tim Chase <python.list@tim.thechases.com>
Newsgroups comp.lang.python
Subject Re: new to python, help please !!
Date Thu, 12 Nov 2015 09:00:58 -0600
Lines 21
Message-ID <mailman.272.1447341014.16136.python-list@python.org> (permalink)
References <93aef8e5-3d6f-41f4-a625-cd3c2007686e@googlegroups.com> <20151111110655.7293d3b7@bigbox.christie.dr> <n229b9$hh9$1@ger.gmane.org>
Mime-Version 1.0
Content-Type text/plain; charset=US-ASCII
Content-Transfer-Encoding 7bit
X-Trace news.uni-berlin.de lty7uMwuuoeyYPV/MId5tARI16D1vx7WpBJ6SydbSecA==
Return-Path <python.list@tim.thechases.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'prefix': 0.07; 'subject:help': 0.07; 'cc:addr:python-list': 0.09; 'chunks': 0.09; 'yeah,': 0.09; 'python': 0.10; 'files.': 0.13; 'subject:python': 0.14; '-tkc': 0.16; 'b):': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'to:addr:web.de': 0.16; 'wrote:': 0.16; 'later': 0.16; 'detect': 0.18; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'posted': 0.21; 'cc:no real name:2**0': 0.22; 'tim': 0.24; 'header:In-Reply-To:1': 0.24; 'compare': 0.27; 'chase': 0.29; 'noticed': 0.32; 'open': 0.33; 'file': 0.34; 'subject:please': 0.35; 'but': 0.36; 'skip:i 20': 0.36; 'should': 0.36; 'instead': 0.36; 'lines': 0.36; 'subject:: ': 0.37; 'received:10': 0.37; 'charset:us-ascii': 0.37; 'version': 0.38; 'files': 0.38; 'or,': 0.38; 'received:50': 0.66; 'difference.': 0.84; 'otten': 0.84
X-Sender-Id wwwh|x-authuser|tim@thechases.com
X-Sender-Id wwwh|x-authuser|tim@thechases.com
X-MC-Relay Neutral
X-MailChannels-SenderId wwwh|x-authuser|tim@thechases.com
X-MailChannels-Auth-Id wwwh
X-MC-Loop-Signature 1447340545664:2000846442
X-MC-Ingress-Time 1447340545664
In-Reply-To <n229b9$hh9$1@ger.gmane.org>
X-Mailer Claws Mail 3.11.1 (GTK+ 2.24.25; x86_64-pc-linux-gnu)
X-AuthUser tim@thechases.com
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
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>
Xref csiph.com comp.lang.python:98699

Show key headers only | View raw


On 2015-11-12 15:56, Peter Otten wrote:
> Tim Chase wrote:
> 
> >   with open("file1.md5") as a, open("file2.md5") as b:
> >     for s1, s2 in zip(a, b):
> >       if s1 != s2:
> >         print("Files differ")
> 
> Note that this will not detect extra lines in one of the files.
> I recommend that you use itertools.zip_longest (izip_longest in
> Python 2) instead of the built-in zip().

Yeah, I noticed that after pushing <send> but then posted a later
version that just read chunks of the file which should catch that
file-size difference.  Or, as in that other message, prefix it with
an fstat() check to compare file-sizes so that you don't even have to
open the files if the sizes differ.

-tkc

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


Thread

new to python, help please !! Anas Belemlih <anas.belemlih@gmail.com> - 2015-11-11 08:34 -0800
  Re: new to python, help please !! John Gordon <gordon@panix.com> - 2015-11-11 16:58 +0000
  Re: new to python, help please !! Tim Chase <python.list@tim.thechases.com> - 2015-11-11 11:06 -0600
  Re: new to python, help please !! Ben Finney <ben+python@benfinney.id.au> - 2015-11-12 04:16 +1100
  Re: new to python, help please !! Quivis <quivis@domain.invalid> - 2015-11-11 17:48 +0000
    Re: new to python, help please !! Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-11-12 13:58 +1100
      Re: new to python, help please !! Marko Rauhamaa <marko@pacujo.net> - 2015-11-12 08:21 +0200
        Re: new to python, help please !! Tim Chase <python.list@tim.thechases.com> - 2015-11-12 05:48 -0600
        Re: new to python, help please !! <paul.hermeneutic@gmail.com> - 2015-11-12 07:27 -0700
      Re: new to python, help please !! Quivis <quivis@domain.invalid> - 2015-11-12 17:55 +0000
        Re: new to python, help please !! Denis McMahon <denismfmcmahon@gmail.com> - 2015-11-12 19:49 +0000
  Re: new to python, help please !! Peter Otten <__peter__@web.de> - 2015-11-12 15:56 +0100
  Re: new to python, help please !! Tim Chase <python.list@tim.thechases.com> - 2015-11-12 09:00 -0600
  Re: new to python, help please !! Peter Otten <__peter__@web.de> - 2015-11-12 16:41 +0100
  Re: new to python, help please !! Denis McMahon <denismfmcmahon@gmail.com> - 2015-11-12 21:24 +0000

csiph-web