CBSE CLASS 12 PYTHON
CSV Files
Notes By: Anand Sir | YouTube Channel: CODEITUP
Notes By: Anand Sir | YouTube Channel: CODEITUP
Notes By: Anand Sir | YouTube Channel: CODEITUP
Notes By: Anand Sir | YouTube Channel: CODEITUP
Notes By: Anand Sir | YouTube Channel: CODEITUP
Notes By: Anand Sir | YouTube Channel: CODEITUP
Notes By: Anand Sir | YouTube Channel: CODEITUP
Notes By: Anand Sir | YouTube Channel: CODEITUP
def write():
import csv
with open("[Link]","w",newline='') as fobj:
f=[Link](fobj)
[Link](['Roll','Name','Marks'])
while True:
roll=int(input("Enter Roll Number:"))
name=input("Enter Name:")
marks=int(input("Enter Marks:"))
data=[roll,name,marks]
[Link](data)
choice=int(input("1->Enter More\n2-
>Exit\nEnter Your Choice:"))
if choice==2:
break
print("File Created Successfully...")
Notes By: Anand Sir | YouTube Channel: CODEITUP
def read():
import csv
with open("[Link]","r") as fobj:
f=[Link](fobj)
for i in f:
print(i)
def search():
import csv
with open("[Link]","r") as fobj:
f=[Link](fobj)
next(f)
rno=int(input("Enter Roll Number to Search:"))
gurpreet=0
for i in f:
if int(i[0])==rno:
gurpreet=1
print(i)
break
if gurpreet==0:
print("Roll Number Not Found...")
Notes By: Anand Sir | YouTube Channel: CODEITUP
def max():
import csv
with open("[Link]","r") as fobj:
f=[Link](fobj)
next(f)
maxnum=0
for i in f:
if int(i[2])>maxnum:
maxnum=int(i[2])
z=i
print("Max Value=",z)
#__main__
#write()
#read()
#search()
#max()
countrows()
Notes By: Anand Sir | YouTube Channel: CODEITUP