List、Numpy的切片操作
List、Numpy的切片操作List切片操作切片格式:list[start:stop:step]样例:nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]print(nums[:])print(nums[2:7]) #取值2-7print(nums[:6])print(nums[3:])print("步长默认为1")print(nums[:6:2]) #取值0-6 步长为2print(nums[3::2])prin
原创
2021-05-10 15:35:46 ·
236 阅读 ·
2 评论