human_list

asdf.util.human_list(l, separator='and')[source]

Formats a list for human readability.

Parameters

l : sequence

A sequence of strings

separator : string, optional

The word to use between the last two entries. Default: "and".

Returns

formatted_list : string

Examples

>>> human_list(["vanilla", "strawberry", "chocolate"], "or")
'vanilla, strawberry or chocolate'