首页 > 解决方案 > Python中的“大约等于”操作数

问题描述

你们知道“大约等于”操作数是什么吗?我需要在列表中找到大约等于我定义的固定数字的数字。我试过做=~== ~float但没有工作。下面是我尝试做的示例代码。提前致谢!

for c1 in range(len(path_Limon_Lib_Chorotega)):
for c2 in range(len(path_Limon_Lib_Chorotega[c1][0])):
    if path_Limon_Lib_Chorotega[c1][0][c2] == ~11.264:
    # if path_Limon_Lib_Chorotega[c1][0][c2] > 11.264 and path_Limon_Lib_Chorotega[c1][0][c2] < 60.8:
        coords_Limon_Lib_Chorotega[c1].append(
            (
                path_Limon_Lib_Chorotega[c1]["Lat"][c2],
                path_Limon_Lib_Chorotega[c1]["Long"][c2]
            )
        )

标签: pythonfloating-accuracyoperands

解决方案


推荐阅读