6
Python常用内置数据结构和算法
source link: http://blog.ilibrary.me/2019/07/15/python%E5%B8%B8%E7%94%A8%E5%86%85%E7%BD%AE%E7%AE%97%E6%B3%95
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
欢迎转载,请支持原创,保留原文链接:blog.ilibrary.me
常用数据结构和算法
- 字符串转数组: [x for x in “aaxxddbb”], [*“xxxaaabbbeee”]
- collections.Counter, 统计词频用. 这个在统计分类里面用的非常多。
- collections.deque,It’s pronounced /dɛk/
- math.ceil, math.floor, math.round, int(3.0/2)
- bisect.bisect_left, bisect.bisect_right
- sorted, List.sort()
- filter
- functools.reduce
- apply
- translate, maketrans
- range
- enumerate
- dict, set,str
- next(generator)
- yield, 生成generator
- heapq
- any, all
- 基础运算: //,**, %, 3.5%1.5=0.5
- heapq:
扫描二维码分享到微信朋友圈Loading...Please wait
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK