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']
- Extract text from PDF File using Python
- Extract numbers from a text file and add them using Python
- Python program to Reverse a single line of a text file
- Python program to Count the Number of occurrences of a key-value pair in a text file
- Convert Text and Text File to PDF using Python
- Python | Scramble words from a text file
- Saving Text, JSON, and CSV to a File in Python
- Convert Text file to JSON in Python
- Python | Program to extract frames using OpenCV
- Count number of lines in a text file in Python
- Python | Finding 'n' Character Words in a Text File
- Python program to reverse the content of a file and store it in another 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 delete a file
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.