Prerequisite : Pattern Matching with Python Regex
Given the URL text-file, the task is to extract all the email-ids from that text file and print the
urllib.request library can be used to handle all the URL related work.
Input : Hello This is Geeksforgeeks firstname.lastname@example.org email@example.com GfG is a portal for geeks firstname.lastname@example.org email@example.com Output :   ['firstname.lastname@example.org'] ['email@example.com']  ['firstname.lastname@example.org'] ['email@example.com']
URL text file can be handled using
urllib.request. For extracting the emails using regular expressions,
re library can be used. For more details of Regular Expression, refer this.
  ['firstname.lastname@example.org'] ['email@example.com']  ['firstname.lastname@example.org'] ['email@example.com']
- Convert Text and Text File to PDF using Python
- Convert Text file to JSON in Python
- Python | Scramble words from a text file
- Python | Create an empty text file with current date as its name
- Python | Count occurrences of each word in given text file (Using dictionary)
- Python | Program to extract frames using OpenCV
- Python Program to delete a file
- Python Program to merge two files into a third file
- numpy.extract() in Python
- reStructuredText | .rst file to HTML file using Python for Documentations
- Python | Pandas Series.str.extract()
- Python | Extract key-value of dictionary in variables
- Python | Extract URL from HTML using lxml
- Python | Extract words from given string
- Python | Extract numbers from string
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.