Update web-qa.py
This commit is contained in:
parent
a7b8506c6e
commit
a2837aa5cd
1 changed files with 2 additions and 2 deletions
|
|
@ -135,7 +135,7 @@ def crawl(url):
|
|||
print(url) # for debugging and to see the progress
|
||||
|
||||
# Save text from the url to a <url>.txt file
|
||||
with open('text/'+local_domain+'/'+url[8:].replace("/", "_") + ".txt", "w", encoding="utf-8") as f:
|
||||
with open('text/'+local_domain+'/'+url[8:].replace("/", "_") + ".txt", "w", encoding="UTF-8") as f:
|
||||
|
||||
# Get the text from the URL using BeautifulSoup
|
||||
soup = BeautifulSoup(requests.get(url).text, "html.parser")
|
||||
|
|
@ -181,7 +181,7 @@ texts=[]
|
|||
for file in os.listdir("text/" + domain + "/"):
|
||||
|
||||
# Open the file and read the text
|
||||
with open("text/" + domain + "/" + file, "r", encoding="utf-8") as f:
|
||||
with open("text/" + domain + "/" + file, "r", encoding="UTF-8") as f:
|
||||
text = f.read()
|
||||
|
||||
# Omit the first 11 lines and the last 4 lines, then replace -, _, and #update with spaces.
|
||||
|
|
|
|||
Loading…
Reference in a new issue