This question already has an answer here:
(这个问题在这里已有答案:)
(如何在Python中连接两个列表?)
(25个答案)
In Python, the only way I can find to concatenate two lists is list.extend , which modifies the first list.
list.extend
(在Python中,我可以找到连接两个列表的唯一方法是list.extend ,它修改了第一个列表。)
(是否有任何串联函数返回其结果而不修改其参数?)
Yes: list1+list2 .
list1+list2
(是: list1+list2 。)
list1
list2
(这给出了一个新列表,它是list1和list2的串联。)
1.4m articles
1.4m replys
5 comments
57.0k users