How to compute a delta: the difference between lists of strings

J. Mwebaze jmwebaze at gmail.com
Sat May 5 08:12:56 EDT 2012


This is out of curiosity, i know this can be done with python diffllib
module, but been figuring out how to compute the delta, Consider two lists
below.

s1 = ['e', 'f', 'g', 'A', 'B', 'C', 'D', 'C']
s2 =['e', 'A', 'B', 'f', 'g', 'C', 'D', 'z']

This is the result should be

['  e', '+ A', '+ B', '  f', '  g', '- A', '- B', '  C', '  D', '- C', '+
z']

ideas on how to approach this.. ?

-- 
*Mob UG: +256 (0) 70 1735800 | NL +31 (0) 6 852 841 38 | Gtalk: jmwebaze |
skype: mwebazej | URL: www.astro.rug.nl/~jmwebaze

/* Life runs on code */*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20120505/91eed873/attachment-0001.html>


More information about the Python-list mailing list