我有一个如下字典:
sample_dict = {
"matchings": [
{
"indices": [
0,
1,
2
],
"geometry": "hemo_Ab}gueC????",
"matched_points": [
[
-33.823845,
-70.619614
],
[
-33.823845,
-70.619614
],
[
-33.823845,
-70.619614
]
]
}
]
}
如何更新几何值?
答案 0 :(得分:0)
您可以使用以下语法遍历matchings
:
for i, matching in enumerate(sample_json['matchings']):
# i is your matching's index
# matching is your current matching object
my_new_value = 'something'
sample_json["matchings"][i]["geometry"] = my_new_value