bundles / IPython 9.11.0 / IPython / utils / text / get_text_list
function
IPython.utils.text:get_text_list
source: /IPython/utils/text.py :616
Signature
def get_text_list ( list_ : List[str] , last_sep : str = and , sep : str = , , wrap_item_with : str = '' ) → str Summary
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