CSV File
CSV File
CSV File
shreya salhotra
11889
S. No. Question Page No.
Q1) WAP to create a csv file.
import csv
def createcsv():
c = csv.writer(f)
while True:
per = float(input("Percentage:"))
c.writerow(line)
ch = input("Enter n to terminate.")
if ch.lower() == "n":
break
f.close()
createcsv()
def createcsv():
c = csv.writer(f)
lines = []
while True:
per = float(input("Percentage:"))
lines.append(line)
ch = input("Enter n to terminate.")
if ch.lower() == "n":
break
c.writerows(lines)
f.close()
createcsv()
def readfile():
c = csv.reader(f)
for i in c:
print(i)
f.close()
readfile()