(x, separator=', ', final_separator=None)
return separator.join(map(str, x[:-1])) + final_separator + str(x[-1])
Join a list with an optional final separator.
Join a list with an optional final separator.
Join a list with an optional final separator .
def list_to_str(x, separator=', ', final_separator=None):
    """Join a list with an optional final separator."""
    if final_separator is None:
        final_separator = ' {} '.format(LANGUAGE.strings['Words']['And'])

    if not x:
        return ''
    x = tuple(x)
    if len(x) == 1:
        return str(x[0])
    return separator.join(map(str, x[:-1])) + final_separator + str(x[-1])
def list_to_str ( x , separator = ', ' , final_separator = None ) : if final_separator is None : final_separator = ' {} ' . format ( LANGUAGE . strings [ 'Words' ] [ 'And' ] ) if not x : return '' x = tuple ( x ) if len ( x ) == 1 : return str ( x [ 0 ] ) return separator . join ( map ( str , x [ : - 1 ] ) ) + final_separator + str ( x [ - 1 ] )