如何传输以下代码的输出:
“It is our choices, Harry, that show what we truly are, far more than our abilities.”
“There are only two ways to live your life. One is as though nothing is a miracle. The other is as though everything is a miracle.”
“The person, be it gentleman or lady, who has not pleasure in a good novel, must be intolerably stupid.”
一个列表式的版本?你知道吗
[[“It is our choices, Harry, that show what we truly are, far more than our abilities.”],
[“There are only two ways to live your life. One is as though nothing is a miracle. The other is as though everything is a miracle.”],
[“The person, be it gentleman or lady, who has not pleasure in a good novel, must be intolerably stupid.”]]
这是我的密码:
from random import choice,sample
import requests
from bs4 import BeautifulSoup
from csv import writer
page = 1
response = requests.get('http://quotes.toscrape.com/page/'+ str(page))
soup = BeautifulSoup(response.text, 'html.parser')
articles = soup.find_all(class_="quote")
for a in articles:
list_of_quotes = []
data = a.find(class_="text")
quotes = data.get_text()
list_of_quotes.append(quotes)
data1 = a.find(class_="author")
author = data1.get_text()
data3 = a.find('a')
href = data3['href']
print(quotes)`from random import choice,sample
相关问题 更多 >
编程相关推荐