【问题标题】:How to extract coordinated from json file in Python3如何在 Python3 中从 json 文件中提取坐标
【发布时间】:2020-10-16 12:25:38
【问题描述】:
{
"FAM": {
    "COORDINATES": [
        [
            50,
            50
        ],
        [
            90,
            100
        ],
        [
            60,
            30
        ]
    ]
},

"radius": 10

}

我有三个不同坐标的 json 文件。我需要提取坐标并将它们以圆形的形式放在图像文件中。

我正在寻找有关如何提取坐标的建议。 任何帮助将不胜感激

【问题讨论】:

    标签: json python-3.x numpy


    【解决方案1】:
    import json
    
    with open ('ex.json', 'r') as f:
        config = json.load(f)
        
    #print(config)
    
    coords = config['FAM']['COORDINATES']
    
    print(coords)
    

    这会将坐标存储在coords 中并打印出来。这是否回答了您的问题?

    【讨论】:

      猜你喜欢
      • 2020-11-26
      • 1970-01-01
      • 1970-01-01
      • 2013-10-05
      • 2014-05-18
      • 2019-02-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多