python - How to find an index at which a new item can be inserted into sorted list and keep it sorted? -
a = 132 b = [0, 10, 30, 60, 100, 150, 210, 280, 340, 480, 530] i want know a should in 6th position in ordered list b.
what's pythonic way so?
use bisect. it's not beautiful api, it's need.
you'll want use bisect.bisect, returns want.
Comments
Post a Comment