📜  python 获取列表中最接近的值 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:09.628000             🧑  作者: Mango

代码示例1
def takeClosest(num,collection):
   return min(collection,key=lambda x:abs(x-num))