尝试找出如何使用“for”循环(或任何其他循环)循环URL
我在Howlongtobeat.com上抓取数据url的结构如下:
如果只有“id=”结尾处的数字发生变化,如何使字符串结尾处的数字发生变化
page_number = range (38040, 38060)
url = 'https://howlongtobeat.com/game.php?id={page_number}'
这不起作用,因为我没有添加到字符串
及
url = 'https://howlongtobeat.com/game.php?id=' + page_number
不起作用是因为我犯了这个错误
TypeError: must be str, not range
供参考使用beautifulsoup和csv writer废弃数据并将其写入csv
我是这方面的初学者,所以从顶部开始
谢谢
输出:
相关问题 更多 >
编程相关推荐