I've got a list, ['a', 'b', 'c', 'd'].  I want to generate the string, "a, b, 
c, and d" (I'll settle for no comma after 'c').  Is there some standard way to 
do this, handling all the special cases?

[] ==> ''
['a'] ==> 'a'
['a', 'b'] ==> 'a and b'
['a', 'b', 'c', 'd'] ==> 'a, b, and c'

It seems like the kind of thing django.contrib.humanize would handle, but alas, 
it doesn't.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to