RSS
菜单

Python itertools 模块常用函数有哪些?

无限迭代器:count(start, step)、cycle(iterable)(循环)、repeat(x, n);组合:product(笛卡尔积)、permutations(排列)、combinations(组合)、combinations_with_replacement;分组/合并:chain(串联)、groupby(分组,需先排序)、zip_longest、accumulate(累加,可传 func);筛选:islice(切片)、takewhile/dropwhile、filterfalse。全部惰性求值、省内存。应用:排列组合枚举、数据分桶、流式处理。

下载推广海报

圈内讨论推广海报

《Python itertools 模块常用函数有哪些?》完整推广海报
一起交流

全部回复 0

分享经验,让问题更进一步

讨论,从你的观点开始

还没有回复,欢迎补充经验或分享不同的思路。