Ric Da Force <[EMAIL PROTECTED]> wrote: > I have a string such as 'C1, C2, C3'. Without assuming that each bit of > text is of fixed size, what is the easiest way to change this list so that > it reads: > 'C1, C2 and C3' regardless of the length of the string.
>>> import re >>> data = "the first bit, then the second, finally the third" >>> re.sub(r"(.*),", r"\1 and", data) 'the first bit, then the second and finally the third' >>> Florian -- begin signature_virus Hi! I'm a signature virus. Please copy me to your signature to help me spread. end -- http://mail.python.org/mailman/listinfo/python-list