I have a CSV file containing emails in which i need to validate if there are more than one columns, if there are then i need to reject the file, I was thinking of reading each line and using "in" operation to check if first row contains comma , although in one of the yahoo link https://in.answers.yahoo.com/question/index?qid=20101211183849AAy3gVh i found that we can have commas in email address if in double quotes.
What should be the logic here?
can't use csv or pandas module
first 3 rows of file:
dilkash.manghani@gmail.com, dilkash.manghani@gmail.com
dilkash123@gmail.com, dilkash123@gmail.com
dilkash423@gmail.com, dilkash523@gmail.com
code:
with open("file.csv", "r") as f:
data = f.read().split('\n')
for email in data:
if "," in email:
raise Exception("invalid")