Advertisements
Advertisements
प्रश्न
What is the difference between reader() and DictReader() function?
Advertisements
उत्तर
| reader() | DictReader() function |
| csv. reader and csv.writer work with list/ tuple | csv.DictReader and csv.DictWriter work with dictionary. |
| csv. reader and csv.writer do not take additional argument. | csv.DictReader and csv.DictWriter take additional argument fieldnames that are used as dictionary keys. |
APPEARS IN
संबंधित प्रश्न
Mention the two ways to read a CSV file using Python.
Mention the default modes of the File.
Write a Python program to read a CSV file with default delimiter comma (,).
What is the difference between the write mode and append mode?
Write the different methods to read a File in Python.
Write a Python program to write a CSV File with custom quotes.
Write the rules to be followed to format the data in a CSV file.
What is the advantage of using a CSV file for permanent storage? Write a Program in Python that defines and calls the following user-defined functions:
- ADD() - To accept and add data of an employee to a CSV file ‘record.csv’. Each record consists of a list with field elements such as empid, name, and mobile to store an employee id, employee name, and employee salary respectively.
- COUNTR() - To count the number of records present in the CSV file named ‘record.csv’.
Give any one point of difference between a binary file and a CSV file. Write a Program in Python that defines and calls the following user-defined functions:
- add() - To accept and add data of an employee to a CSV file ‘furdata.csv’. Each record consists of a list with field elements such as fid, fname, and fprice to store furniture id, furniture name, and furniture price respectively.
- search() - To display the records of the furniture whose price is more than 10000.
Select the correct output of the code:
S="Amrit Mahotsav @ 75"
A=S.partition (" ")
print(a)