Create:
List = list(range(s, t, step))
List = []
newList = List.copy()
newList = List[:]
List = [x**2 for x in range(1, 11) if x % 2 == 0]
List = [m + n for m in [2, 4] for n in [2, 5] ]
matrix = [[0 for col in range(3)] for row in range(3)]
AddTerm:
List.append(value)
List.insert(idx, value)
List.extend(iterable)
Delete:
del List[idx]
List.pop([idx])
List.remove(value) 只删除第一个
while value in List: 删除全部
List.remove(value)
List.clear()
Check:
value in List
value not in List
Iterate:
for value in List:
for idx, value in enumerate(List):
Reverse:
List.reverse()
Sort:
# 就地排序
List.sort() 升序
List.sort(reverse=True) 降序
List.sort(key=str.lower) 字符串列表字典序升序
# 临时排序
sortedList = sorted(List)
sortedList = sorted(List, reverse=True)
Statistics:
min(List)
max(List)
sum(List)
List.count(value)
Find:
List.index(value)
Slice:
List[s:t:step]
List[:3] 前三个
List[-3:] 后三个
Python List 梳理Create:List = list(range(s, t, step))List = []List.copy()List[:][x**2 for x in range(1, 11) if x % 2 == 0][m + n for m in [2, 4] for n in [2, 5] ]AddTerm:List.append(value)Lis...