import requests
r=requests.get("https://quotes.toscrape.com/")
z=r.text
#open("filename","mode either read or write")
with open('quotes.txt','w') as f:
for line in z.split("\n"):
if'<span class="text" itemprop="text">' in line:
(line.replace('<span class="text" itemprop="text">',' ').replace("</span>",""))
line=line.strip()
f.write(line)
f.write("\n")