List Formatting

This module lets you format lists of items in a locale-dependent manner.

babel.lists.format_list(lst, locale='en_US_POSIX')

Format the items in lst as a list.

>>> format_list(['apples', 'oranges', 'pears'], 'en')
u'apples, oranges, and pears'
>>> format_list(['apples', 'oranges', 'pears'], 'zh')
u'apples\u3001oranges\u548cpears'
Parameters:
  • lst – a sequence of items to format in to a list
  • locale – the locale