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']
- Python | Scramble words from a text file
- Python | Count occurrences of each word in given text file (Using dictionary)
- Python | Create an empty text file with current date as its name
- Python | Program to extract frames using OpenCV
- Python Program to delete a file
- numpy.extract() in Python
- reStructuredText | .rst file to HTML file using Python for Documentations
- Python | Extract digits from given string
- Python | Extract numbers from string
- Python | Extract URL from HTML using lxml
- Python | Pandas Series.str.extract()
- Python | Extract words from given string
- Python | Extract key-value of dictionary in variables
- Python | Extract only characters from given string
- Extract images from video in Python
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.