May-25-2021, 08:25 PM
hello. I have this Python code, that makes a Parsing. But I want to save the results in the save.txt file. How can I do that? How to save python screen output to a text file? I am using PyScripter.
Quote:from urllib.request import urlopen
from bs4 import BeautifulSoup
html = urlopen("http://www.pythonscraping.com/exercises/exercise1.html")
bsObj = BeautifulSoup(html, "html.parser")
print(bsObj.title)
print(bsObj.h1)