01 查
列表的查询与字符串的切边几乎一样,切片去查或者循环去查
如:
![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
l1 = ['das', 'dfsdf',[1,23,],'asda'] li = l1[0] print(li) l2 = l1[0:3] print(l2)
![](https://i-blog.csdnimg.cn/blog_migrate/ca3a78e33d1bcdc6091e3a6fe9ffa647.png)
02 增
1 append 增加到最后
![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
l1 = ['das', 'dfsdf',[1,23,],'asda'] l1.append('sfdg') l1.append(324314) print(l1)
![](https://i-blog.csdnimg.cn/blog_migrate/84b022f0911cacf8159c68ccfb963a6e.png)
![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
l1 = ['das', 'dfsdf',[1,23,],'asda'] while 1: username = input('>>>') if username.upper().strip() == 'Q': break else: l1.append(username) print(l1)
02 insert 选择插入
03 extend 迭代添加
![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
l1 = ['das', 'dfsdf',[1,23,],'asda'] l1.extend("udhsfi") l1.extend([1,2,3,4,5,6]) print(l1)
![](https://i-blog.csdnimg.cn/blog_migrate/1ae96ddbabd00f4875d00d9dcff8a921.png)