Here we are going to write a script which will find email ids from given text file .
Say the text file is file.txt . The content in the file is as bellow .
Hi you can mail me at admin@borahshell.com but its not a real mail id . If you want to mail me desperately , you can mail me at anuj@borahshell.com which is also not a real mail id .
We will write the script like this .
SCRIPT:
file=open('file.txt','r')
file1=file.read()
import re
print re.compile(r'\w+\@\w+\.\w+').findall(file1)
You will get output like bellow .
Very easy right .
You can subscribe to my facebook borahshell page HERE
Say the text file is file.txt . The content in the file is as bellow .
Hi you can mail me at admin@borahshell.com but its not a real mail id . If you want to mail me desperately , you can mail me at anuj@borahshell.com which is also not a real mail id .
We will write the script like this .
SCRIPT:
file=open('file.txt','r')
file1=file.read()
import re
print re.compile(r'\w+\@\w+\.\w+').findall(file1)
You will get output like bellow .
Very easy right .
You can subscribe to my facebook borahshell page HERE
No comments:
Post a Comment