import bisect
# 查找。查找元素在有序数组的位置
a = [1, 3, 4, 5, 7, 12, 33, 46]
position = bisect.bisect(a,22)
print('position:',position) # position: 6
a.insert(position,22)
print('a:',a) # a: [1, 3, 4, 5, 7, 12, 22, 33, 46]
import bisect
b = [1, 3, 4, 5, 7, 12, 33, 46]
bisect.insort(b,22)
print('b:',b) # b: [1, 3, 4, 5, 7, 12, 22, 33, 46]