您可以通过将格式设置推迟到打印时间来避免在列表中的每个字符串上添加逗号。连接除最后一个项目以外的所有项目
',',然后使用格式插入连接的字符串,其中最后一个项目与以下项连接
and:
listed.append(inputed)...print('{}, and {}'.format(', '.join(listed[:-1]), listed[-1]))演示:
>>> listed = ['a', 'b', 'c', 'd']>>> print('{}, and {}'.format(', '.join(listed[:-1]), listed[-1]))a, b, c, and d


