2025-09-10:仓库迁移
This commit is contained in:
14
1.数据结构与算法/1.序列分解.py
Normal file
14
1.数据结构与算法/1.序列分解.py
Normal file
@@ -0,0 +1,14 @@
|
||||
|
||||
# 普通的序列分解方式
|
||||
def normal_func(list):
|
||||
# list是可迭代对象,能够直接分解成多个元素
|
||||
length = list.__len__()
|
||||
length= 2
|
||||
x, y = list
|
||||
|
||||
# 如果list长度和接数据的元素数量不匹配,会造成错误
|
||||
x, y, z = list
|
||||
|
||||
# 在知道元素顺序的情况下想要丢弃list中的某些元素,可以用下划线来无视变量
|
||||
_ ,y = list
|
||||
|
Reference in New Issue
Block a user