I have a long list of subscribers. Right now I'm writing all of them to one csv file. I want to split them up so that every 1000th row I create a new file and start writing to that, and so on until finished.
Current code:
with open(path, mode='w', newline='') as filename:
writer = csv.writer(
filename,
delimiter=';',
quotechar='"',
quoting=csv.QUOTE_MINIMAL
)
writer.writerow(['email', 'name'])
for subscriber in subscribers:
writer.writerow([subscriber['Email'], subscriber['Name']])
How can I extend this to get the functionaly I need?