网站地址:https://www.nytimes.com/
写一个Python程序,从一个给定的新闻页面上获取前五个头条新闻.
``python从bs4进口的进口请求 BeautifulSoup url = "https://www.nytimes.com/"响应 = requests.get(url)  = BeautifulSoup(response.text, "html.parser") 标题 = soup.find_all('h2', class_='e1voiwgp0') 为 i 在范围中(5): print(str(i + 1) + ". " + 标题[i].文本) ```