2025-09-10:仓库迁移

This commit is contained in:
2025-09-10 16:12:45 +08:00
parent e0e49b0ac9
commit 3130e336a1
146 changed files with 4066 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
items = [0,1,2,3,4,5,6]
# 我们可以使用内置的slice函数对切片进行命名,参数分别为start|stop|step
a = slice(2,6,2)
print(items[a])
print(a.start, a.stop, a.step)
# indeces方法可以帮我们把start和stop自动限制在序列长度内,并返回一个限制后的切片
s = "sukahelloworld"
# 上面那个可能看着不明显,但是下面这个看着就明显多了
# s = "suka"
print(a.indices(len(s)))
# 因为返回的是元组,所以要使用得先解包
for i in range(*a.indices(len(s))):
print(s[i])