Here is my code:
import csv
def addr():
with open('csvfile.csv','a',newline='') as f:
w=csv.writer(f,delimiter=',')
tid=int(input('Teacher ID: '))
nm=input('Enter Name: ')
mo=int(input('Mobile Number: '))
w.writerow(tid,nm,mo)
def countr():
with open('csvfile.csv') as f:
c=csv.rowcount
print('Number of records:',c)
while True:
addr()
if input('Do you Wish to Continue? (Y/N): ').lower() in ('n','no'):
break
It showed no error when I tried to use the normal file.write()