Re: deleting texts between patterns

2006-06-04 Thread Baoqiu Cui
es = '''line1 ... abc ... line2 ... xyz ... line3 ... aaabc ... line4 ... xxxyz ... line5''' >>> pattern = re.compile('(?<=^abc\n).*?(?=^xyz\n)', re.DOTALL | re.MULTILINE) >>> print pattern.sub('', lines) line1 abc xyz line3 aaabc line4 xxxyz line5 >>> - Baoqiu -- Baoqiu Cui -- http://mail.python.org/mailman/listinfo/python-list

Re: a Python bug in processing __del__ method ??

2005-01-30 Thread Baoqiu Cui
Fredrik and Steve, Thank you so much for the help. Now I know more about Python. :-) Steve's test does explain why 'peter1' is OK while 'peter' is not: 'peter1' appears before 'Person' in the globals while 'peter' is after. The error message is just a little confusing to a Python newbie, I thin

a Python bug in processing __del__ method ??

2005-01-30 Thread Baoqiu Cui
Today I was playing with a small Python program using Python 2.4 on Cygwin (up-to-date version, on Windows XP), but ran into a strange error on the following small program (named bug.py): --- #!/usr/bin/python class Person: population = 0 def __del__(self): Person.popu