Computer Science, asked by arifanadeem24, 9 months ago

wap in python to remove all the lines that contain the character 'a' in a file and write it to another file?
don't answer if u don't know...

correct answer will be marked as brainlist...
plzzz dont spam

Answers

Answered by mahi0588
0

So to remove all the lines that contain the character `a’ in a file and write it to another file we can revise the code as follows:

try:

filepath = ‘’#path of file to be read-sepeated by //

with open(filepath) as fp,open(‘’, ‘w’) as outfile:#new file path

for cnt, line in enumerate(fp):

line=line.replace(‘a’,’’)

outfile.write(line)

finally:

fp.close()

hope it will help you

plz mark my answer brainlist...

Answered by geethikabestha
0

please pls help me out of it

Attachments:
Similar questions