newb: comapring two strings
justin.azoff at gmail.com
Fri May 19 02:41:36 CEST 2006
> 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 and the difference is ('i','e')
something like this maybe?
>>> set(enumerate(str1)) ^ set(enumerate(str2))
set([(4, 'e'), (4, 'i')])
More information about the Python-list