python bisect module

来源:互联网 发布:查淘宝排名的软件 编辑:程序博客网 时间:2024/04/29 20:32

import bisect

 

bisect is used to insert data to a sorted list

 

for example:

a = [ 1, 5, 8, 100 ]

bisect.insort( a, 9 ), then a is 1, 5, 8, 9, 100

 

bisect.bisect( a, 9 ) => 获取插入点的位置,如果插入9, 那么它的位置是多少