Re: [Tutor] Help with multiple substitution

2009-07-24 Thread vince spicer
not perfect or tested but import re chopset.reverse() #: put the longer extensions first exts = "|".join([re.escape(x) fro x in chopset)]) for line in file: print exts.sub("", line) On Fri, Jul 24, 2009 at 9:22 AM, vankayala sailakshman < sailakshm...@hotmail.com> wrote: > > Hi All, > >

[Tutor] Help with multiple substitution

2009-07-24 Thread vankayala sailakshman
Hi All, Help needed to write a python script!!! Iam a python newbie and my problem is doing multiple substitution in a text file using Python regular expressions. Here is my following data, I need to chop of all the extensions that are given in the following list