with open("emails.csv", "w") as csvfile:
for control_rent_email in control_group_renters:
email_writer = csv.writer(csvfile, quotechar='"', quoting=csv.QUOTE_NONNUMERIC,delimiter=',')
email_writer.writerow([control_rent_email])
csvfile.close()
I get the following output in the "emails.csv":
"[email protected]"
"[email protected]"
"[email protected]"
But I want the output to be
'[email protected]',
'[email protected]',
'[email protected]'
How do I put the correct parameters in csv.writer() to achieve this desired result?
UPDATE:
1)
email_writer = csv.writer(csvfile, quotechar=''', quoting=csv.QUOTE_NONNUMERIC,delimiter=',')
SyntaxError: EOL while scanning string literal
2) How do I place the "," to look like the output result?
It looks to be your quotechar. Try: