---
title: "python切割"
author: "lfc_jack"
date: "2018-02-07T22:53:46Z"
tags: ["Python"]
categories: ["编程语言"]
slug: "python"
draft: false
lastmod: "2018-02-07T22:53:46Z"
id: 2410510
url: "https://lfc-jack.iteye.com/blog/2410510"
---

```python


def funThree(list01):
    newList = []
    for i in range(0,len(list01)):
        count = len(newList)
        if count == 0:
            newList.append([list01[i]])
        else:
            if list01[i] in newList[count-1]:
                newList[count-1].append(list01[i])
            else:
                newList.append([list01[i]])
    return newList
#测试
list01 = funThree([1,1,1,1,1,0,0,0,0,0,0,0,1,1,0,0,0,1,1,0,1,1,0,0,0,1,1,0])
print(list01)


```



#运行结果：
, , , , , , , , , ]