any faster alternative??

Posted by kaushik on Stack Overflow See other posts from Stack Overflow or by kaushik
Published on 2010-06-09T17:24:01Z Indexed on 2010/06/09 17:32 UTC
Read the original article Hit count: 156

Filed under:

have file data of format

3.343445 1  
3.54564 1  
4.345535 1  
2.453454 1

and so on upto 1000 lines and i have number given such as a=2.44443 for the given file i need to find the row number of the numbers in file which is most close to the given number "a" how can i do this i am presently doing by loading whole file into list and comparing each element and finding the closest one any other better faster method?

© Stack Overflow or respective owner

Related posts about python