Regular exp matching delimited string excepting trailing delimiters?
Jeff Kowalczyk
jtk at yahoo.com
Fri Nov 1 08:27:34 EST 2002
> You mean just trim the tail of commas? In that case just skip the re and do
> >>> 'A,,C,123,D,,,,,J,,,,,,,'.rstrip(',')
> 'A,,C,123,D,,,,,J'
> Regards, Bengt Richter
That's really cool and much more appropriate than a RegExp, but it doesn't seem to work in
my Python 2.1.3 or Python 2.2.1, is there any trick to it?
>>> 'yada,,,,'.rstrip(',')
Traceback (most recent call last):
File "<interactive input>", line 1, in ?
TypeError: rstrip() takes no arguments (1 given)
>>> mystring.rstrip(',')
Traceback (most recent call last):
File "<interactive input>", line 1, in ?
TypeError: rstrip() takes no arguments (1 given)
More information about the Python-list
mailing list