Peng Yu wrote: > I want to delete the line with abc in the following program. But the > following program does not do what I want. Can somebody let me know > how to do it?
> file="""abcd > efg > hijk > lmn > """ > > regex = re.compile("^abcd$", re.MULTILINE) > print regex.sub('', file), What /do/ you want? If you want to remove the trailing newline regex = re.compile("^abcd$\n?", re.MULTILINE) might work. Peter -- http://mail.python.org/mailman/listinfo/python-list