将列表中的一个字符串转换为列表中的两个字符串

2024-10-01 07:45:03 发布

您现在位置:Python中文网/ 问答频道 /正文

我有这样一个清单:

['Mark', 'Reynold', 'Peter', 'Randall Macenroe'] #The list is a lot longer, so I can't go by index

我想把这个列表换成另一个列表:

['Mark', 'Reynold', 'Peter', 'Randall', 'Macenroe']

我该怎么做?我当然可以用两个名字之间的空格(两个名字之间总是有空格),但是怎么用呢


Tags: the列表sois名字canlistpeter