No products in the cart.

Write a program in which Remove …

CBSE, JEE, NEET, CUET

CBSE, JEE, NEET, CUET

Question Bank, Mock Tests, Exam Papers

NCERT Solutions, Sample Papers, Notes, Videos

Write a program in which Remove all the lines that contains a character 'a' in a file and write it to another file.
  • 2 answers

Vivek Vaish 4 years, 4 months ago

Nd after else?

Gaurav Seth 4 years, 4 months ago

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:

http://mycbseguide.com/examin8/

Related Questions

What is mean by buffering in file handling?
  • 1 answers
What are called tokens
  • 2 answers

myCBSEguide App

myCBSEguide

Trusted by 1 Crore+ Students

Test Generator

Test Generator

Create papers online. It's FREE.

CUET Mock Tests

CUET Mock Tests

75,000+ questions to practice only on myCBSEguide app

Download myCBSEguide App