<jupyter_start><jupyter_text>宣告<jupyter_code>a = [1, 2, 3]
b = [1, 'abc', 2.0, ['a', 'b', 'c']]
c = list([1, 2, 3])
print(a, type(a))
print(b, type(b))
print(c, type(c))<jupyter_output>[1, 2, 3] <class 'list'>
[1, 'abc', 2.0, ['a', 'b', 'c']] <class 'list'>
[1, 2, 3] <class 'list'><jupyter_text>切片<jupyter_code>print(a[1])
print(a[1:])
print(a[-1])<jupyter_output>2
[2, 3]
3<jupyter_text>基本操作<jupyter_code>list1 = [9, 1, -4, 3, 7, 11, 3]

print('長度=', len(list1))
print('最大=', max(list1))
print('最小=', min(list1))
print('反向=', list1[::-1])
print('3總共出現:', list1.count(3))

list1.sort(reverse=True)
print('排序:', list1)

list1.sort(reverse=False)
print('排序:', list1)
list2 = ['a', 'c', 'd']

# 擴增
list2.append('e')
print(list2)

# 插入
list2.insert(1, 'b')
print(list2)

# 移除
list2.remove('b')
print(list2)

# 賦值
list2[0] = '1'
print(list2)<jupyter_output>['a', 'c', 'd', 'e']
['a', 'b', 'c', 'd', 'e']
['a', 'c', 'd', 'e']
['1', 'c', 'd', 'e']
{'fraction_non_alphanumeric': 0.31243358129649307, 'fraction_numerical': 0.06269925611052073, 'mean_word_length': 6.359375, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '356889', 'license': 'MIT', 'n_tokens_mistral': 541, 'n_tokens_neox': 533, 'n_words': 100, 'path': 'Python/[Python] List.ipynb', 'repo_name': 'ZongSingHuang/Data-Scientist-Tokyo', 'size': '941'}