import bisect
L = [1,3,3,5,7,9]
x = 30
##在L中查找x,x存在时返回x左侧的位置 x不存在返回应该插入的位置
x_insert_point = bisect.bisect_left(L,x)
print(x_insert_point)
#在L中查找x,x存在时返回x右侧的位置,x不存在返回应该插入的位置
x_insert_point = bisect.bisect_right(L,x)
print(x_insert_point)
#将x插入到列表L中,x存在时插入在左侧
x_insert_left = bisect.insort_left(L,x)
print(L)
#将x插入到列表L中,x存在时插入在右侧
x_insert_left = bisect.insort_right(L,x)
print(L)