想知道最好的方法是从howlongtobeat.com网站会是
我想把一个电子表格放在一起,需要这些数据
我的想法是给我们Python3,美丽的苏泊尔,硒,但不知道最好的方式去做
我正在使用Linux(Ubuntu18.04)命令控制台,可以使用一些技巧(非常新)
这是我目前掌握的代码:
url = 'https://howlongtobeat.com/game.php?id=38050'
response = get(url)
from bs4 import BeautifulSoup
html_soup = BeautifulSoup(response.text, 'html.parser')
type(html_soup)
game_containers = html_soup.find_all('div', class_ = 'li.short:nth-of-type(2)')
first_game = game_containers[0]
first_game.text
出现如下错误:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IndexError: list index out of range
之后返回:
'\nGod of War (2018) '
我想从中得到的是页面上的“30个半小时”(理想情况下是30.5小时,但我认为我可以使用excel,除非在这个阶段有办法做到这一点)
告诉我该怎么做
我需要硒吗?你知道吗
谢谢你
返回
game_times
统计表的ResultSet
。你知道吗使用
[-1]
获取最后一项,并获取其text
:打印:
30½ Hours
相关问题 更多 >
编程相关推荐