Lets build an email scraper in python that will scrape a bunch of emails from text and save them in a .csv file

Lets build an email scraper in python that will scrape a bunch of emails from text and save them in a .csv file

Welcome to the Email Extractor-inator! This wacky Python program will turn your messy pile of emails into a neatly organized CSV file. Just follow these simple steps:

  1. Copy and paste your string of email-filled gibberish into the input_string variable.

  2. Sit back and watch as the Email Extractor-inator uses its trusty regex (regular expression) to pluck out all the emails like a chicken at a county fair.

  3. The extracted emails will be stored in the emails list, ready to be written into a CSV file with a simple command.

  4. BAM! Your emails are now organized and easy to access. No more digging through piles of paper or scrolling through a never-ending inbox.

Are you ready to try out the Email Extractor-inator? Here's the code:

import csv
import re

# input string containing emails
input_string = '''
Paste your string of emails here.
'''

# regex to extract emails
regex = r'[\w\.-]+@[\w\.-]+'

# extract all emails
emails = re.findall(regex, input_string)

# write extracted emails to a CSV file
with open('emails.csv', 'w') as csvfile:
    writer = csv.writer(csvfile)
    for email in emails:
        writer.writerow([email])

Give the Email Extractor-inator a try and see how it can revolutionize your email organization game!

If you don't know what to search for to scrape emails, click here. It will redirect you to a Google search with a pre-filled query. You can modify the query to fit your needs. just ctrl + A and ctrl + c and paste in the input_string variable