python bisect module

    技术2026-01-03  5

    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, 那么它的位置是多少

     

    最新回复(0)