【问题标题】:Python Requests module - Strip back contentPython 请求模块 - 剥离内容
【发布时间】:2020-03-29 00:33:42
【问题描述】:

我正在尝试从下面指定的链接调用 Web 请求(可能会根据您阅读本文的时间略有变化),但我只想要其中的特定部分,它都是一行。从"version":"12.30"我想保留12.30部分我需要使用什么代码?

链接: https://fortnite-public-service-stage.ol.epicgames.com/fortnite/api/version

【问题讨论】:

    标签: python python-3.x python-requests


    【解决方案1】:

    你可以告诉 requests 模块,它应该将 json 字符串转换为字典,然后访问版本

    url = "https://fortnite-public-service-stage.ol.epicgames.com/fortnite/api/version"
    response = requests.get(url)
    version = response.json()["version"]
    

    【讨论】:

      猜你喜欢
      • 2020-08-22
      • 2020-10-23
      • 2011-07-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-10-19
      • 2019-09-25
      • 1970-01-01
      相关资源
      最近更新 更多