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


Groups > comp.lang.python > #17989

Re: How to check for single character change in a string?

From tinnews@isbd.co.uk
Newsgroups comp.lang.python
Subject Re: How to check for single character change in a string?
Date 2011-12-26 22:37 +0000
Message-ID <gi9ns8-aot.ln1@chris.zbmc.eu> (permalink)
References <th7hs8-one.ln1@chris.zbmc.eu> <roy-AAAEEA.10571424122011@news.panix.com> <roy-BABC0C.11104024122011@news.panix.com>

Show all headers | View raw


Roy Smith <roy@panix.com> wrote:
> In article <roy-AAAEEA.10571424122011@news.panix.com>,
>  Roy Smith <roy@panix.com> wrote:
> 
> > >>> len([x for x in zip(s1, s2) if x[0] != x[1]])
> 
> Heh, Ian Kelly's version:
> 
> > sum(a == b for a, b in zip(str1, str2))
> 
> is cleaner than mine.  Except that Ian's counts matches and the OP asked 
> for non-matches, but that's an exercise for the reader :-)

:-)

I'm actually walking through a directory tree and checking that file
characteristics don't change in a sequence of files.  

What I'm looking for is 'unusual' changes in file characteristics
(they're image files with camera information and such in them) in a
sequential list of files.

Thus if file001, file002, file003, file004 have the same camera type
I'm happy, but if file003 appears to have been taken with a different
camera something is probably amiss.  I realise there will be *two*
character changes when going from file009 to file010 but I can cope
with that.  I can't just extract the sequence number because in some
cases they have non-numeric names, etc.

-- 
Chris Green

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


Thread

How to check for single character change in a string? tinnews@isbd.co.uk - 2011-12-24 15:26 +0000
  Re: How to check for single character change in a string? Roy Smith <roy@panix.com> - 2011-12-24 10:57 -0500
    Re: How to check for single character change in a string? Roy Smith <roy@panix.com> - 2011-12-24 11:10 -0500
      Re: How to check for single character change in a string? Arnaud Delobelle <arnodel@gmail.com> - 2011-12-24 17:09 +0000
        Re: How to check for single character change in a string? Rick Johnson <rantingrickjohnson@gmail.com> - 2011-12-24 10:22 -0800
      Re: How to check for single character change in a string? tinnews@isbd.co.uk - 2011-12-26 22:37 +0000
  Re: How to check for single character change in a string? Ian Kelly <ian.g.kelly@gmail.com> - 2011-12-24 08:57 -0700

csiph-web