欢迎来到飞鸟慕鱼博客,开始您的技术之旅!
当前位置: 首页知识笔记正文

python list切割,python连续切片

墨初 知识笔记 101阅读

Def partition (lst): partition [] starts the 0 # traversal list. For I(len(lst)): # in the range, the current element is less than or equal to the previous element, and the previous element is the demarcation point if lst[I]lst[I-1].IF i03360Start0Else3360Partitions. (lst [start3360i]) Start I # The last group of Partitions. (lst [start:]) returns the partition input :lst [1,2,3, 4, 2, 3, 4, 5, 6, 3, 5, 6] Out-of-partition (lst) output out [[1, 2, 3, 4], [2, 3, 4, 5, 6]] The application scenarios of the above codes are limited and need to be expanded as needed.

标签:
声明:无特别说明,转载请标明本文来源!