Re: comapring two strings

2006-05-18 Thread Paul Rubin
"Paul McGuire" <[EMAIL PROTECTED]> writes: > >>> def offByNoMoreThanOneCharacter(a,b): > ... return len(a)==len(b) and sum(map(lambda (x,y): x==y, zip(a,b))) >= > len(a)-1 Yikes! How about (untested): def offByNoMoreThanOneCharacter(a,b): return len(a)==len(b) and \ len([i for i i

Re: comapring two strings

2006-05-18 Thread Paul McGuire
"manstey" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > Is there a clever way to see if two strings of the same length vary by > only one character, and what the character is in both strings. > > E.g. str1=yaqtil str2=yaqtel > > they differ at str1[4] and the difference is