<jupyter_start><jupyter_text>列表List- 一个列表可以储存任意大小的数据集合，你可以理解为他是一个容器<jupyter_code>[x for x in range(10) if x%2==0]
[]<jupyter_output><empty_output><jupyter_text>先来一个例子爽一爽![](../Photo/115.png)<jupyter_code>import math
d=0
for i in average:
    b=num[i]-average
    c=b**2
    d=d+c
a=math.sqrt(d)<jupyter_output><empty_output><jupyter_text>创建一个列表- a = [1,2,3,4,5]  列表的一般操作![](../Photo/116.png)  列表索引操作- Mylist[index]- 正序索引，逆序索引- 列表一定注意越界- ![](../Photo/117.png)  列表切片操作- Mylist[start:end]- 正序切片，逆序切片  列表 +、*、in 、not in  使用for循环遍历元素- for 循环可以遍历一切可迭代元素  EP：- 使用while 循环遍历列表  列表的比较- \>,=,<=,==,!=  列表生成式[x for x in range(10)]  列表的方法![](../Photo/118.png)<jupyter_code>c4=[['a',19],['b',20],['c',5]]
c4.sort()
c4.sort(key=lambda x:x[1],reverse=False)
c4
c=[['Joker',['shuaishuai',0],19],['lala',['meimei',-1],80],['caoyuan',['yuanyuan',8],5]]
sorted(c,key=lambda x:x[1][1],reverse=False)
c1=[1,2,3,6,1,0]
c1.pop()
c1.pop(1)<jupyter_output><empty_output><jupyter_text>将字符串分割成列表- split  按照自定义的内容拆分  EP:![](../Photo/119.png)![](../Photo/120.png)  列表的复制- copy 浅复制- deepcopy import copy  深复制- http://www.pythontutor.com/visualize.htmlmode=edit  列表排序- sort- sorted- 列表的多级排序    - 匿名函数  EP：- 手动排序该列表[5,3,8,0,17]，以升序或者降序<jupyter_code>test1=[5,3,8,0,17]
w=''
for i in range(len(test1)):
    if test1[i]<test1[i+1]:
        w=test1[i]
        test1[i]=test1[i+1]
        test1[i+1]=w
print (test1[i])<jupyter_output><empty_output><jupyter_text>- 1![](../Photo/121.png)<jupyter_code>a=[40,55,70,58]
b=max (a)
print (b)
for i in range(len(a)):
    if a[i]>=b-10:
        g='A'
    elif a[i]>=b-20:
        g='B'
    elif a[i]>=b-30:
        g='C'
    elif a[i]>=b-40:
        g='D'
    else:
        g='E'
    print (a[i],g)<jupyter_output>70
40 C
55 B
70 A
58 B<jupyter_text>- 2![](../Photo/122.png)<jupyter_code>a=[1,2,3,4,5,6]
a.reverse()
a<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.23542116630669546, 'fraction_numerical': 0.06749460043196544, 'mean_word_length': 4.632218844984802, 'pattern_counts': {'":': 0, '<': 26, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '435057', 'license': 'Apache-2.0', 'n_tokens_mistral': 1092, 'n_tokens_neox': 1062, 'n_words': 123, 'path': '7.25.ipynb', 'repo_name': 'gaogaoZ/gaozhe', 'size': '1852'}