On Jun 25, 12:32 pm, Ben Finney <[EMAIL PROTECTED]> wrote: > antar2 <[EMAIL PROTECTED]> writes: > > for x in list1: > > re.compile(x) > > for y in list2: > > re.compile(y) > > if x in y: > > z = re.sub(x, 'u', y) > > but this does not work > > You need to frotz the hymangirator with spangule. > > That, or show us the actual result you're seeing and how it differs > from what you expect to happen. > > -- > \ "I must say that I find television very educational. The minute | > `\ somebody turns it on, I go to the library and read a book." -- | > _o__) Groucho Marx | > Ben Finney
That made me laugh :D Why not a list comprehension ? ::: list1 = ['a','o'] ::: list2 = ['star', 'day', 'work', 'hello'] ::: [l2.replace(l1,'u') for l2 in list2 for l1 in list1 if l1 in l2] ['stur', 'duy', 'wurk', 'hellu'] -- http://mail.python.org/mailman/listinfo/python-list