Computer Science, asked by sreerag17, 5 months ago

Write a python program to remove all the lines that contain the character ‘a’ in a file and
write it to another file

Answers

Answered by nkcthereaper
0

Answer:

with open("file1.txt") as r:

   rr=r.readlines()

   k=[]

   for i in rr:

       if i=="a":

           k.append(i)

with open("file2.txt","w") as w:

   for q in k:

       w.write(str(q))

Explanation:

Similar questions