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


Groups > comp.lang.python > #17850

How to check for single character change in a string?

From tinnews@isbd.co.uk
Newsgroups comp.lang.python
Subject How to check for single character change in a string?
Date 2011-12-24 15:26 +0000
Message-ID <th7hs8-one.ln1@chris.zbmc.eu> (permalink)

Show all headers | View raw


Can anyone suggest a simple/easy way to count how many characters have
changed in a string?

E.g. giving results as follows:-

    abcdefg     abcdefh         1
    abcdefg     abcdekk         2
    abcdefg     gfedcba         6


Note that position is significant, a character in a different position
should not count as a match.

Is there any simpler/neater way than just a for loop running through
both strings and counting non-matching characters?

-- 
Chris Green

Back to comp.lang.python | Previous | NextNext 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