Computer Science, asked by isakshi243, 10 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 Maithilimarne3
3

Explanation:

Answer:infile = file('./oldfile.txt')

newopen = open('./newfile.txt', 'w')

for line in infile :

if 'bad' in line:

line = line.replace('.' , '')

if 'naughty' in line:

line = line.replace('.', '')

else:

Answered by brendinamehmeti13
3

Answer:

Answer:infile = file('./oldfile.txt')

newopen = open('./newfile.txt', 'w')

for line in infile :

if 'bad' in line:

line = line.replace('.' , '')

if 'naughty' in line:

line = line.replace('.', '')

else:

Read more on Brainly.in - https://brainly.in/question/13834299#readmore

Explanation:

Similar questions