# Python Program to extract email-id from URL text file

PythonProgrammingServer Side Programming

Here we are using regular expression package for extracting email-id from the URL-text file. Given the URL- text file. Using regular expression package we define the pattern of email-id then use findall() function, using this method to check the text which will match with this pattern.

Input
Output ['contact@tutorialspoint.com ','feedback@tutorialspoint.com']


## Example code

import re
" You can also give feedback at feedback@tutorialspoint.com"
my_emails = re.findall(r"[a-z0-9\.\-+_]+@[a-z0-9\.\-+_]+\.[a-z]+", my_text)
print (my_emails)


## Output

['contact@tutorialspoint.com', 'feedback@tutorialspoint.com’]

Published on 22-Nov-2018 05:46:59