Skip to content

Instantly share code, notes, and snippets.

@bbelderbos
Created May 23, 2023 13:30
Show Gist options
  • Save bbelderbos/5d6c26651b26e781c974db193c367df6 to your computer and use it in GitHub Desktop.
Save bbelderbos/5d6c26651b26e781c974db193c367df6 to your computer and use it in GitHub Desktop.
import csv
import random
DATA = "MOCK_DATA.csv"
def get_emails(data=DATA):
with open(data) as f:
reader = csv.reader(f)
next(reader)
emails = [row[3] for row in reader]
return emails
def get_random_emails(emails, number_emails=3):
return random.sample(emails, k=number_emails)
if __name__ == "__main__":
all_emails = get_emails()
rand_emails = get_random_emails(all_emails)
print(rand_emails)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment