Ric Da Force 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.

>>> " and".join("C1, C2, C3".rsplit(",", 1))
'C1, C2 and C3'

Peter
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to