gpt4 book ai didi

python 3 : Read json file from url

转载 作者:太空狗 更新时间:2023-10-30 00:24:55 27 4
gpt4 key购买 nike

在python3中,我想加载this_file , 这是一个 json 格式。

基本上,我想做一些类似[伪代码]的事情:

>>> read_from_url = urllib.some_method_open(this_file)
>>> my_dict = json.load(read_from_url)
>>> print(my_dict['some_key'])
some value

最佳答案

你很接近:

import requests
import json
response = json.loads(requests.get("your_url").text)

关于 python 3 : Read json file from url,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39780403/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com