Advertisements
Advertisements
Question
What will be written inside the file test.csv using the following program import csv
D = [['Exam'],['Quarterly'],['Halfyearly']]
csv.register_dialect('M',lineterminator = '\n')
with open('c:\pyprg\ch13\line2.csv', 'w') as f:
wr = csv.writer(f,dialect='M')
wr.writerows(D)
f.close()
Options
Exam Quarterly Halfyearly
Exam Quarterly Halfyearly
E
Q
HExam,
Quarterly,
Halfyearly
Solution
Exam,
Quarterly,
Halfyearly
APPEARS IN
RELATED QUESTIONS
Which of the following is a string used to terminate lines produced by the writer()method of the csv module?
What is the output of the following program? import csv
d=csv.reader(open('c:\PYPRG\ch13\city.csv'))
next(d)
for row in d:
print(row)
if the file called “city.csv” contain the following details
chennai,mylapore |
mumbai,andheri |
Making some changes in the data of the existing file or adding more data is called ______
How will you sort more than one column from a CSV file? Give an example statement.
Write a Python program to modify an existing file.