CODEITUP
CS Class 12 | Chapter 06 | File Handling
Get the CBSE CS PYTHON Class 12 Enroll in Class 12 Explore
[Link] book by Anand Sir CS/CUET CS Live Batches C/C++/Java Courses
CODEITUP
CS Class 12 | Chapter 06 | File Handling
Get the CBSE CS PYTHON Class 12 Enroll in Class 12 Explore
[Link] book by Anand Sir CS/CUET CS Live Batches C/C++/Java Courses
CODEITUP
CS Class 12 | Chapter 06 | File Handling
Get the CBSE CS PYTHON Class 12 Enroll in Class 12 Explore
[Link] book by Anand Sir CS/CUET CS Live Batches C/C++/Java Courses
CODEITUP
CS Class 12 | Chapter 06 | File Handling
Get the CBSE CS PYTHON Class 12 Enroll in Class 12 Explore
[Link] book by Anand Sir CS/CUET CS Live Batches C/C++/Java Courses
CODEITUP
CS Class 12 | Chapter 06 | File Handling
Get the CBSE CS PYTHON Class 12 Enroll in Class 12 Explore
[Link] book by Anand Sir CS/CUET CS Live Batches C/C++/Java Courses
CODEITUP
CS Class 12 | Chapter 06 | File Handling
Get the CBSE CS PYTHON Class 12 Enroll in Class 12 Explore
[Link] book by Anand Sir CS/CUET CS Live Batches C/C++/Java Courses
CODEITUP
CS Class 12 | Chapter 06 | File Handling
Get the CBSE CS PYTHON Class 12 Enroll in Class 12 Explore
[Link] book by Anand Sir CS/CUET CS Live Batches C/C++/Java Courses
CODEITUP
CS Class 12 | Chapter 06 | File Handling
Get the CBSE CS PYTHON Class 12 Enroll in Class 12 Explore
[Link] book by Anand Sir CS/CUET CS Live Batches C/C++/Java Courses
CODEITUP
CS Class 12 | Chapter 06 | File Handling
Get the CBSE CS PYTHON Class 12 Enroll in Class 12 Explore
[Link] book by Anand Sir CS/CUET CS Live Batches C/C++/Java Courses
CODEITUP
CS Class 12 | Chapter 06 | File Handling
Get the CBSE CS PYTHON Class 12 Enroll in Class 12 Explore
[Link] book by Anand Sir CS/CUET CS Live Batches C/C++/Java Courses
CODEITUP
CS Class 12 | Chapter 06 | File Handling
f=open("[Link]","w") f=open("[Link]","w")
roll=int(input("Enter Roll Number:")) while True:
name=input("Enter Name:") roll=int(input("Enter Roll Number:"))
marks=int(input("Enter Marks:"))
name=input("Enter Name:")
data=str(roll)+"\t"+name+"\t"+str(marks)
[Link](data) marks=int(input("Enter Marks:"))
print("File Created Successfully...") data=str(roll)+"\t"+name+"\t"+str(marks)+"\n"
[Link]() [Link](data)
choice=int(input("1->Enter More\n2->Exit\nEnter You
Choice:"))
if choice==2:
f=open("[Link]","a") break
[Link]("This is new data") print("File Created Successfully...")
print("Data Appended [Link]()
Succesfully..")
[Link]()
Get the CBSE CS PYTHON Class 12 Enroll in Class 12 Explore
[Link] book by Anand Sir CS/CUET CS Live Batches C/C++/Java Courses
CODEITUP
CS Class 12 | Chapter 06 | File Handling
f=open("[Link]","w")
names=['ram\t','shyam\t','sita\t','gita'] f=open("[Link]","r")
[Link](names) x=[Link]()
[Link]() print(x)
print("File Created Successfully..")
[Link]()
#Count total number of characters in a text file [Link]
f=open("[Link]","r")
f=open("[Link]","r")
x=[Link](10) x=[Link]()
print(x) print("Total Number of Characters=",len(x))
x=[Link](10) z=[Link]()
print(x) print("Total Number of Words=",len(z))
[Link]() [Link]()
Get the CBSE CS PYTHON Class 12 Enroll in Class 12 Explore
[Link] book by Anand Sir CS/CUET CS Live Batches C/C++/Java Courses
CODEITUP
CS Class 12 | Chapter 06 | File Handling
#Count total number of vowels and consonants.
f=open("[Link]","r")
x=[Link]() #Count total number of Sentences
v=0 f=open("[Link]","r")
c=0 x=[Link]()
for i in x: count=0
if [Link](): for i in x:
if i in 'aeiouAEIOU': if i=='.':
v+=1 count+=1
else: print("Total Sentences=",count)
c+=1 [Link]()
print("Total Vowels=",v,"Total Cons=",c)
[Link]()
#Count total number of lines.
f=open("[Link]","r")
x=[Link]()
print("Total Number of lines=",len(x))
[Link]()
Get the CBSE CS PYTHON Class 12 Enroll in Class 12 Explore
[Link] book by Anand Sir CS/CUET CS Live Batches C/C++/Java Courses
CODEITUP
CS Class 12 | Chapter 06 | File Handling
#Count total number of word “IS” in a file [Link]
f=open("[Link]","r")
x=[Link]()
z=[Link]()
count=0
for i in z:
if ([Link](".,?:;")).upper()=="IS":
count+=1
print("Total Number of Word=",count)
[Link]()
Get the CBSE CS PYTHON Class 12 Enroll in Class 12 Explore
[Link] book by Anand Sir CS/CUET CS Live Batches C/C++/Java Courses
CODEITUP
CS Class 12 | Chapter 06 | File Handling
#Print only those sentences that starts with
"THIS" in a file [Link]
f=open("[Link]","r")
x=[Link]()
for i in x: f=open("[Link]")
x=[Link]() x=[Link]()
if x[0].upper()=="THIS": print(x)
print(i)
x=[Link]()
[Link]()
print(x)
[Link]()
Get the CBSE CS PYTHON Class 12 Enroll in Class 12 Explore
[Link] book by Anand Sir CS/CUET CS Live Batches C/C++/Java Courses
CODEITUP
CS Class 12 | Chapter 06 | File Handling
#Print only those sentences that starts with "THIS" in a
file [Link]
def demo():
f=open("[Link]","r")
x=[Link]() def demo():
for i in x: f=open("[Link]","r")
x=[Link]()
if "This" in x:
x=[Link]()
print(i) data=[Link]()
[Link]() for i in data:
#__main__ if i[0] in 'aeiouAEIOU' and i[-1] in
demo() 'aeiouAEIOU':
print(i)
[Link]()
#__main__
demo()
Get the CBSE CS PYTHON Class 12 Enroll in Class 12 Explore
[Link] book by Anand Sir CS/CUET CS Live Batches C/C++/Java Courses