Skip to content

Commit 0d75e46

Browse files
authored
Update emails-from-website.py
1 parent b9f767b commit 0d75e46

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

extracting-emails-from-website/emails-from-website.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
import re
22
import requests
3+
34
url = input("Enter Url: ")
45
text = requests.get(url).text
5-
x = re.findall(r"[a-zA-Z]+@{1}[a-zA-Z]+[.]{1}[a-zA-Z]+", text) #This is a regex query which search for the particular email format.
6+
7+
x = re.findall(r"[a-zA-Z]+@{1}[a-zA-Z]+[.]{1}[a-zA-Z]+", text) #Regex query which search for the particular email format.
8+
9+
val=""
610
for i in x:
711
val+=i+"\n" #this adds all the email data found in val variable
8-
filename= input("Enter the file Name you want: ") #You can use any file name you want for your output file
12+
13+
filename= input("Enter the file Name you want (without extension):")
914
with open(f"{filename}.txt","w") as file:
1015
file.write(val)
1116
print("Your File has been Saved")

0 commit comments

Comments
 (0)