class CustomFunction:
def __getitem__(self, slices):
slice1, slice2, slice3 = slices
# 在这里执行你的操作
print("第一个切片:", slice1)
print("第二个切片:", slice2)
print("第三个切片:", slice3)
# 创建一个 CustomFunction 的实例
custom_function = CustomFunction()
# 调用 custom_function,传入3个切片作为参数
custom_function[1:2, 3:4, 5:6]
Python定义一个接收3个列表的函数
最新推荐文章于 2024-07-10 19:27:42 发布