bundles / IPython 9.17.0 / IPython / utils / text / get_text_list
function
IPython.utils.text:get_text_list
Signature
def get_text_list(list_: list[str], last_sep: str = and , sep: str = , , wrap_item_with: str = '') → strSummary
Return a string with a natural enumeration of items
Extended Summary
>>> get_text_list(['a', 'b', 'c', 'd']) 'a, b, c and d' >>> get_text_list(['a', 'b', 'c'], ' or ') 'a, b or c' >>> get_text_list(['a', 'b', 'c'], ', ') 'a, b, c' >>> get_text_list(['a', 'b'], ' or ') 'a or b' >>> get_text_list(['a']) 'a' >>> get_text_list([]) '' >>> get_text_list(['a', 'b'], wrap_item_with="`") '`a` and `b`' >>> get_text_list(['a', 'b', 'c', 'd'], " = ", sep=" + ") 'a + b + c = d'
Aliases
IPython.utils.text.get_text_list