Finding the insertion point in a list

Matimus mccredie at gmail.com
Fri Mar 16 16:30:19 EDT 2007


On Mar 16, 11:20 am, "Matimus" <mccre... at gmail.com> wrote:
> You might look at the bisect module (part of the standard
> distribution).

Here is an example:

>>> from bisect import insort
>>> x = [0,100,200,1000]
>>> insort(x,10)
>>> x
[0, 10, 100, 200, 1000]




More information about the Python-list mailing list