from urllib.request import urlopen import re from bs4 import BeautifulSoup url = input("enter full url:") pattern = re.compile("[\w]+.[\w]+") matchobject = pattern.match(url) if (matchobject): print("your website is:",url) html =urlopen(url).read().decode() soup = BeautifulSoup(html,"html.parser") for script in soup(["script", "style"]): script.extract() text = soup.get_text() print(text) with open("C:\\Users\\Aishwarya\\Desktop\\key.txt", "w") as text_file: text_file.write(text) # i have doubt over here text_file.close()
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)