【发布时间】:2019-03-05 20:02:35
【问题描述】:
我正在尝试使用 Python 请求库从 Steam 中抓取一些数据。但首先我需要修改我的网址
例如,如果我想访问带有标签的游戏
- 2D [id : 3871]
- 1980 年代 [id : 7743]
https://store.steampowered.com/search?tags=7743%2C3871
这是我需要的链接。但是当我这样做时
steam_url = "https://store.steampowered.com/search?"
search = request.get(steam_url, params = {'tags' : [7743, 3871]})
我得到了这个网址
https://store.steampowered.com/search?tags=7743&tags=3871
只显示 2D 游戏 [id : 3871]
为了解决这个问题,我尝试这样做
steam_url = "https://store.steampowered.com/search?"
search = get(steam_url, params = {'tags' : '%2C'.join(list(map(str,[7743, 3871])))})
然后我得到这个网址
https://store.steampowered.com/search?tags=7743%252C3871
我不明白为什么这些 id 之间有 %252C。
我该怎么办?
【问题讨论】: