import csv
with open(‘c:\ \pyprg\ \chl3\\dynamicfile.csv’ , ‘w’) as f:
w = csv. writer (f)
ans= ’y’
while (ans= = ’y’):
name= input(“Name?: “)
date = input(“Date of birth: “)
place = input(“Place: “) w.writerow([name, date, place])
ans=input(“Do you want to enter more y/n?: “)
F=open(‘c:\ \pyprg\ \chl3\\dynamiefde.csv, ’r’)
reader = csv.reader(F)
for row in reader:
print(row)
F.close( )
OUTPUT
Name?: Nivethitha
Date of birth: 12/12/2001
Place: Chennai
Do you want to enter more y/n?: y
Name?: Leena
Date of birth: 15/10/2001
Place: Nagercoil
Do you want to enter more y/n?: y
Name?: Padma
Date of birth: 18/08/2001
Place: Kumbakonam
Do you want to enter more y/n?: n
[‘Nivethitha’ , ’12/12/2001′, ‘Chennai’] [ ]
[’Leena’ , ’15/10/2001′, ‘Nagercoil’] [ ]
[‘Padma’ , ’18/08/2001′, ‘Kumbakonam’]