You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
713 B

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2023/4/5 11:26
# @Author : old tom
# @File : fu_collection.py
# @Project : futool-db
# @Desc : 集合类工具
def split_coll(data: [], part_size=5):
"""
分割集合
:param data:
:param part_size:
:return:
"""
rt = []
if len(data) <= part_size:
rt.append(data)
else:
rt.append(data[0:part_size])
for j, d in enumerate(data):
if j > 0 and j % part_size == 0:
rt.append(data[j:j + part_size])
return rt
def is_not_empty(coll: list) -> bool:
"""
集合不为空
:param coll:
:return:
"""
return coll is not None and len(coll) > 0