Search This Blog

Thursday, 18 November 2021

Python program to create a CSV file named “students.csv” to store Roll , name and percentage of students

 Python program to create a CSV file named “students.csv” to store Roll , name and percentage of students

#writing records in csv file
import csv
f=open('student.csv','w',newline='')
stdwriter=csv.writer(f,delimiter=',')
stdwriter.writerow(['Rollno','Name','Marks']) # write header row
stdrec= [
['101', 'Nikhil', '99'],
['102', 'Sanchit', '98'],
['103', 'Aditya', '98'],
['104', 'Sagar', '87'],
['105', 'Prateek', '88'],
]
stdwriter.writerows(stdrec)
f.close()



Output:-
Rollno,Name,Marks
101,Nikhil,69
102,Sanchit,98
103,Aditya,98
104,Sagar,87
105,Prateek,88
106,Abhay,99

No comments:

Post a Comment

how to implement YOLOv3 using Python and TensorFlow

Object Detection with YOLOv3 Introduction YOLOv3 (You Only Look Once version 3) is a real-time object detection algorithm that can detect ob...