## 
系统入门深度学习,直击算法工程师
一.创立列表
1.创立一个普通列表
| 1 2
 3
 
 | >>> tabulation1 = ['大圣','天蓬','卷帘'] >>> tabulation1
 ['大圣', '天蓬', '卷帘']
 
 
 | 
| 1 2
 3
 
 | >>> tabulation2 = [72,36,18] >>> tabulation2
 [72, 36, 18]
 
 
 | 
2.创立一个混合列表
| 1 2
 3
 4
 5
 
 | >>> mix tabulation = ['大圣',72,'天蓬',36] SyntaxError: invalid syntax
 >>> mixtabulation = ['大圣',72,'天蓬',36]
 >>> mixtabulation
 ['大圣', 72, '天蓬', 36]
 
 
 | 
3.创立一个空列表
| 1 2
 3
 
 | >>> empty = [] >>> empty
 []
 
 
 | 
三种方式就引见给大家了,接下来,假如想向列表中添加元素,该怎样办呢?
二.向列表中添加元素
1.append
>>> tabulation1.append('紫霞')
>>> tabulation1
['大圣', '天蓬', '卷帘', '紫霞']
2.extend
>>> tabulation1.extend(['紫霞','青霞'])
>>> tabulation1
['大圣', '天蓬', '卷帘', '紫霞', '紫霞', '青霞']
有关于用extend拓展列表的办法,大家需求留意的是,此办法是用列表去拓展列表,而不是直接添加元素,所以“()”中要加上“[]”。
链接:https://pan.baidu.com/s/14x3Z1-8KpAHlcNhF9QBZLQ 
提取码:q8w7 
--来自百度网盘超级会员V4的分享