Question: Also, the code below is the triangle.error.py file that given along. use this code for question 2. Write a program that replaces all the occurrences

Write a program that replaces all the occurrences of an existing specified string from a text file with a new Open the triangle_error.py file given along with this task. Within this file, define an exception class named 

Also, the code below is the triangle.error.py file that given along. use this code for question 2. 


import math class GeometricShape: def __init__(self, colour= class Triangle (GeometricShape): def_init_(self, sidel, side2, side3): super()._init_(self) self. sidel =

Write a program that replaces all the occurrences of an existing specified string from a text file with a new specified string. Your program should prompt the user to enter a filename, an existing string, and a new string. (For simplicity, convert all letters to lowercase.) Here is a sample run: Enter a filename: test.txt Enter the existing string to be replaced: morning Enter the new string to replace the existing string: evening Done

Step by Step Solution

3.58 Rating (155 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Task 1 Replacing Occurrences in a Text File Prompt the user for input filename inputEnter a filename ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!