[Python] Grammatically correct human readable string from list (with Oxford comma)

Discussão em 'Python' iniciado por Stack, Agosto 29, 2025.

  1. Stack

    Stack Membro Participativo

    I want a grammatically correct human-readable string representation of a list. For example, the list ['A', 2, None, 'B,B', 'C,C,C'] should return the string A, 2, None, B,B, and C,C,C. This contrived example is somewhat necessary. Note that the Oxford comma is relevant for this question.

    I tried ', '.join(seq) but this doesn't produce the expected result for the aforementioned example.

    Note the preexisting similar questions:


    Continue reading...

Compartilhe esta Página