Skip to content

Instantly share code, notes, and snippets.

@johanlantz
Created May 26, 2017 17:08
Show Gist options
  • Save johanlantz/542de5a20962ce6b2d775f0529fbff46 to your computer and use it in GitHub Desktop.
Save johanlantz/542de5a20962ce6b2d775f0529fbff46 to your computer and use it in GitHub Desktop.
import os
#1. Export all subscribers from the customer list and the muy molon list
#2. Run this script
#3. In Sendy, chose mass delete and upload the duplicates.csv file.
customer_list_to_keep_as_string = open('all-spanish-customers.csv', 'r').read()
list_to_filter = open('list-to-filter-all.csv', 'r')
duplicate_file = open('duplicates.csv', 'w')
line = list_to_filter.readline()
number_of_duplicates = 0
while line != "":
email = line.split(",")[1].partition('\"')[-1].rpartition('\"')[0]
if (customer_list_to_keep_as_string.find(email) != -1):
print("Duplicate: " + email)
number_of_duplicates = number_of_duplicates + 1
duplicate_file.write(email + "\n")
line = list_to_filter.readline()
print ("Found " + str(number_of_duplicates) + " duplicates")
@johanlantz
Copy link
Author

Python script to remove email in a csv. Using it for Prestsahop subscriver list to remove Sendy customers that has converted from only signups in the mailing list to real customers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment