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

Popular posts from this blog

Glib GIOChannel -

jsp - java.sql.SQLException: [Microsoft][ODBC Microsoft Access > Driver] Too few parameters. Expected 1 -

delphi - When I encode/decode SMS PDU (GSM 7 Bit) user data, do I need prepend the UDH first? -