import csv
with open("C:\\Users\\ki386179\\Desktop\\output.csv","r") as f:
reader = csv.reader(f)
for row in reader:
if 'india' in row:
pass
if 'india' not in row:
with open("C:\\Users\\ki386179\\Desktop\\output.csv","w") as f:
writer = csv.writer(f)
writer.writerow('india')
I am trying to achieve something like this , to check for a particular value in a particular column and if not write to it.
output.csvfile and expected final state of the file