[triangle-zpug] how to match strings in python

Jay Lyerly jayl at sonicbunny.org
Thu Apr 2 18:15:15 UTC 2009


For the python golfers.....

a='foobar'
b='foobaz'

m=''
for (x,y) in zip(a,b):  m+= x * (x==y)

m contains the matching substring.  That's as close to one line as I  
could get.  :)

Cheers,
jay



More information about the triangle-zpug mailing list