【发布时间】:2021-10-22 01:58:14
【问题描述】:
我有一个具有这样值的字典(坐标 = [cx1, cx2, cy1, cy2]):
> co_list =
[
{
"data.01": [
6.9490666,
47.4897206,
7.0073678,
47.5169333
]
},
{
"data.02": [
6.9493157,
47.4627392,
7.0075872,
47.4899521
]
}
]
根据用户输入,我得到了一个包含 4 个坐标的列表(bbox = [bx1, by1, bx2, by2])
bb_list = [6.974532, 47.469739, 7.000004, 47.481432]
我想检查 bb_list 是否适合 co_list 的值,如果左下角或右上角在一定范围内,则应返回相应的键。我如何在 co_list 的每个值/值上迭代 bb_list 的值,并且它们应该通过类似的方式进行比较:
如果 bx1 >= cx1 and = cy1 and = cx1 and = cy1
欢迎任何帮助,谢谢!
【问题讨论】:
标签: python list loops dictionary compare