【问题标题】:Python Requests module - Strip back dictionary contentPython Requests 模块 - 剥离字典内容
【发布时间】:2020-08-22 15:40:03
【问题描述】:

我正在尝试从下面指定的链接调用 Web 请求(可能会根据您阅读本文的时间略有变化),但我只想要其中的特定部分,它都是一行。从“构建”部分:“++Fortnite+Release-12.50-CL-13193885-Windows”我想保留 ++Fortnite+Release-12.50-CL-13193885-Windows 部分。

我需要使用什么代码?这就是我目前所拥有的......

url = "https://fortnite-api.com/v2/aes" response = requests.get(url) updateloop = response.json()["build"]

链接:https://fortnite-api.com/v2/aes

【问题讨论】:

  • 我投票结束这个问题,因为这个问题没有具体的重点,似乎是更一般的计算建议而不是编码帮助

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


【解决方案1】:

做事

updateloop = response.json()["data"]["build"].replace("++Fortnite+Release-", "")

输出

'12.50-CL-13193885-Windows'

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-12-20
    • 2011-07-30
    • 2018-07-11
    • 2019-09-25
    • 1970-01-01
    • 2017-03-03
    • 2016-05-29
    • 1970-01-01
    相关资源
    最近更新 更多