Last active
February 11, 2020 21:30
-
-
Save realmayus/c668ff0e49fe14d55102aec1c00a2077 to your computer and use it in GitHub Desktop.
Takes a list of Email addresses along with names in the format "Name Name <email@email.com>\n" and converts them to a CSV file that you can import into google contacts.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with open('contacts.csv', 'a') as newF: | |
newF.write('Name,"E-mail 1 - Value"\n') | |
newF.close() | |
with open('contacts.txt') as f: | |
for line in f: | |
name, email = line.split('<') | |
name = name[:-1] | |
email = email[:-3] | |
print("Name:" + name + ", Email: " + email + "\n") | |
with open('contacts.csv', 'a') as newF: | |
newF.write(name + "," + email + "\n") | |
newF.close() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment