Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsreader4.netcologne.de!news.netcologne.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: tinnews@isbd.co.uk Newsgroups: comp.lang.python Subject: How to check for single character change in a string? Date: Sat, 24 Dec 2011 15:26:21 +0000 Lines: 18 Message-ID: X-Trace: individual.net xEAPNJ8l1d3p2bx/mFrA4wfAAL0EC0sl8IlHllZzm+kCtTiTc= X-Orig-Path: not-for-mail Cancel-Lock: sha1:kp5ulNj6LGXuLO1xO5ZactyQl+Q= User-Agent: tin/2.0.0-20110623 ("Burnside") (UNIX) (Linux/3.0.0-14-generic (x86_64)) Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:17850 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