The bisect
module provides functions to insert items in sorted sequences.
insort(sequence,
item)
inserts an item into the
sequence, keeping it sorted. The sequence can be any mutable sequence
object that implements _ _getitem_ _
and
insert
; Example 14-28 demonstrates.
In Example 14-29, bisect(sequence,
item) => index
returns the
index where the item should be inserted. The sequence is not
modified.
18.119.106.237