Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #98697
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | <paul.hermeneutic@gmail.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: new to python, help please !! |
| Date | Thu, 12 Nov 2015 07:27:29 -0700 |
| Lines | 40 |
| Message-ID | <mailman.270.1447338456.16136.python-list@python.org> (permalink) |
| References | <93aef8e5-3d6f-41f4-a625-cd3c2007686e@googlegroups.com> <obL0y.222880$6i2.63495@fx35.am4> <5644005e$0$2932$c3e8da3$76491128@news.astraweb.com> <8737wbu49x.fsf@elektro.pacujo.net> <20151112054812.3603d4de@bigbox.christie.dr> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| X-Trace | news.uni-berlin.de igMjkMxgHIfV+nmGtWNxTg/sQk4l2TQ77BqO278n8SIw== |
| Return-Path | <paul.hermeneutic@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'else:': 0.03; 'subject:help': 0.07; 'cc:addr:python-list': 0.09; 'chunk_size': 0.09; 'chunks': 0.09; 'eof': 0.09; 'to:addr:python.list': 0.09; 'to:addr:tim.thechases.com': 0.09; 'to:name:tim chase': 0.09; 'subject:python': 0.14; '-tkc': 0.16; '1024': 0.16; 'cmp': 0.16; 'md5': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'true:': 0.16; 'wrote:on': 0.16; 'wrote:': 0.16; '>': 0.18; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'cc:no real name:2**0': 0.22; 'am,': 0.23; 'header:In-Reply-To:1': 0.24; 'compare': 0.27; 'message-id:@mail.gmail.com': 0.27; 'large.': 0.29; 'url:mailman': 0.30; 'url:python': 0.33; 'url:listinfo': 0.34; 'received:google.com': 0.35; 'nov': 0.35; 'subject:please': 0.35; 'should': 0.36; 'url:org': 0.36; 'received:209.85': 0.36; 'subject:: ': 0.37; 'really': 0.37; 'two': 0.37; '12,': 0.37; 'wanted': 0.37; 'received:209': 0.38; 'files': 0.38; 'url:mail': 0.40; 'some': 0.40; 'from:no real name:2**0': 0.60; 'skip:n 10': 0.62 |
| 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:to :cc:content-type; bh=GZ1U2wQPKqErysN5v692Z/YspEo+eA6uk2/dLtLyT5o=; b=Nk7Wwcl1aFNPaNqseTIDboqem6Rf3cqFsBI20zr4zcYbsQSLjBI5pb+tkHELXwYsSF d3LqEuby7sawrPSCwpJu47GXTObrunQywqx9/NO0vX/fngCpAl2NVDTRhOaRvCEs3102 Ah/A4YUERpahLkWti1gzhv1pcoUat70eyD6TZE86h+5df/S29iEzZzT3scJ0d8vKa2Q5 LhJhReJHoTEfKbu2t6KjrQ6p7oDfiqZEQSpWzuIf1khg4Q6UsdiAg1/imW6kIYs0nuE4 gEgBH8DzhiPji6Jjt7RHmv9UAqY9TpideoC4PV5nOadtZki89EaGm03qWyKi6CV75sNl bFJQ== |
| X-Received | by 10.112.61.166 with SMTP id q6mr2327023lbr.70.1447338449612; Thu, 12 Nov 2015 06:27:29 -0800 (PST) |
| In-Reply-To | <20151112054812.3603d4de@bigbox.christie.dr> |
| X-Content-Filtered-By | Mailman/MimeDel 2.1.20+ |
| 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:98697 |
Show key headers only | View raw
Would some form of subprocess.Popen() on cmp or fc /b be easier?
On Nov 12, 2015 7:13 AM, "Tim Chase" <python.list@tim.thechases.com> wrote:
> On 2015-11-12 08:21, Marko Rauhamaa wrote:
> > And if you really wanted to compare two files that are known to
> > contain MD5 checksums, the simplest way is:
> >
> > with open('f1.md5') as f1, open('f2.md5') as f2:
> > if f1.read() == f2.read():
> > ...
> > else:
> > ...
>
> Though that suffers if the files are large. Might try
>
> CHUNK_SIZE = 4 * 1024 # read 4k chunks
> # chunk_offset = 0
> with open('f1.md5') as f1, open('f2.md5') as f2:
> while True:
> c1 = f1.read(CHUNK_SIZE)
> c2 = f2.read(CHUNK_SIZE)
> if c1 or c2:
> # chunk_offset += 1
> if c1 != c2:
> not_the_same(c1, c2)
> # not_the_same(chunk_offset * CHUNK_SIZE, c1, c2)
> break
> else: # EOF
> the_same()
> break
>
> which should perform better if the files are huge
>
> -tkc
>
>
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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