In this article, you will get the important programs python CSV class 12. These programs can be used for your practical file. We have already given list of programs for:

Text Files – Click here to open

Binary Files – Click here to open

Programs python CSV class 12

In this section of Programs python CSV class 12 we will read see 3 programs to read csv file contents and print them on output screen.

[1] Read a CSV file top5.csv and print the contents in a proper format. The data for top5.csv file are as following:

SNoBatsmanTeamRunsHighest
1K L RahulKXI670132*
2S DhawanDC618106*
3David WarnerSRH54885*
4Shreyas IyerDC51988*
5Ishan KishanMI51699

[2] Read a CSV file emp.csv and print the contents as it is without list brackets.

EmpCodeENamePostSalaryDepartment
1001ShobhitManager55000Finance
1002ManmitClerk35000Office
1003SujalDevelopment Officer65000R & D
1004ManishaTele Caller42000Communication
1005GayatriSystem Analyst53000Software

Suggested: Notes CSV

[3] Read a CSV file students.csv and print them with tab delimiter. Ignore first row header to print in tabular form.

In the next section, we will discuss how to write records in the CSV file using python code. Do practice for following programs python CSV class 12:

[4] Write records of customer into result.csv. The fields are as following:

Field 1Data Type
StudentIDInteger
StudentNameString
ScoreInteger

The next program of programs python csv class 12 read contents as into dictionary object.

[5] Read and print above file contents in the form dictionary.

[6] Read Students name and score from the CSV file.

[7] Count the number of records and column names present in the CSV file.

Concepts used:

  1. Skip first row using next() method
  2. line_num properties used to count the no. of rows

Recommended: Python CSV Assignments

Due to some technical reasons I couldn’t maintain the indentation in the python code properly. So download the code from below given link. Like our facebook page and download the codes.

More programs will be added and updated regularly. If you have any specific problem and feel something is missing in this article – programs python CSV class 12, let us know through comments.

Share this article as much as you can so more people will learn and practice these programs on programs python csv class 12.

I hope you enjoyed the practical part of the CSV file. Click on the provided link to find more codes and practice questions from the suggested and recommended links. Moreover, if you are looking for more contents on class 12 computer science using the below-given link:

Computer Science Class 12

Leave a Reply