今天爱分享给大家带来Python中列表的append和extend的区别【面试题详解】,希望能够帮助到大家。
>>> x = [1, 2] >>> x.append(3) >>> x [1, 2, 3] >>> x.append([4,5]) >>> x [1, 2, 3, [4, 5]] >>> >>> x = [1, 2, 3] >>> x.extend([4, 5]) >>> x [1, 2, 3, 4, 5]
原文链接:https://blog.itblood.com/4440.html,转载请注明出处。

![极道无頼: 横滨按摩店篇 pc+安卓 STEAM官方中文[简+繁] [SLG/官中/动态]](https://news.2046acg.xyz/i/2024/06/02/665c004d2f46c.jpg)