Python常用基础知识笔记
3. Python常用内置工具
3.1 itertools模块
官方文档:https://docs.python.org/3/library/itertools.html
参考链接:https://www.jianshu.com/p/2ef28b04fcd4
- chain()
下面代码利用
chain.from_iterable()
可快速将二维转为一维
from itertools import chain
a = [[1, 2], [3, 4]]
print(list(chain.from_iterable(a))) # [1, 2, 3, 4]
3.2 os模块
3.3 shutil模块
3.4 random模块
3.5 collections模块
3.5.1 deque()双向队列
3.5.2 Counter()
3.6 queue模块
3.7 bisect模块
创作不易,喜欢的话加个关注点个赞,❤谢谢谢谢❤