Search and Replace
Summary:
For this assignment you will open a file and find all instances of the string
"Lady Gaga" in the file and replace the instances of "Lady Gaga" with "Taylor Swift"
and write the revised line instances to a different file.
Details:
Write a Python program that opens the attached file: [login to view URL] the documentView in a new window. Create a
second file called ahs2.txt. Create [login to view URL] in Python.
Your program should read each line of ahs1.txt. For each line, replace
"Lady Gaga" with "Taylor Swift" and write the line to ahs2.txt. You should
Google "Python String Functions" to find out how to use the [login to view URL]() method,
which is used to replace one string with another in a line of text.
As you read and write each line, you should print the old line and the new
line.
You will lose points if you don't document each
function above the function definition in comments.
Be sure to put the file [login to view URL] in your Eclipse workspace directory for your project.
Or, give the complete path to the file. Otherwise your program will not be able
to find your [login to view URL] file.
Submit your .py file and your [login to view URL] file that your program creates.
Below is what the output of your program should look like:
Old: There are few shows on television (if any) that top American Horror Story
New: There are few shows on television (if any) that top American Horror Story
Old: in the consistently spine tingling, terror inducing niche. And after
New: in the consistently spine tingling, terror inducing niche. And after
Old: several seasons of Jessica Langes bone-chilling characters, the Ryan
New: several seasons of Jessica Langes bone-chilling characters, the Ryan
Old: Murphy led show is switching things up this season with none other
New: Murphy led show is switching things up this season with none other
Old: than Lady Gaga, who plays the blood sucking proprietor of Hotel Cortez.
New: than Taylor Swift, who plays the blood sucking proprietor of Hotel Cortez.
Old: That Lady Gaga is no stranger to out-there costumes certainly bodes well
New: That Taylor Swift is no stranger to out-there costumes certainly bodes well
Old: for AHS: Hotel (Season 5). There iss also sure to be plenty of blood and
New: for AHS: Hotel (Season 5). There iss also sure to be plenty of blood and
Old: gore to go around so downright perfect for Halloween.
New: gore to go around so downright perfect for Halloween.
Old: Here is a primer on how to the get Lady Gagas AHS look.
New: Here is a primer on how to the get Taylor Swifts AHS look.
Hello, this could take 1 hour or 2, or less maybe :)
Let me know if I can help you :)
Please let me know more about the project by sending me a message, or something :)
$30 USD 1 päivässä
5,0 (25 arvostelua)
4,8
4,8
3 freelancerit tarjoavat keskimäärin $25 USD tätä projektia
Hay, I have gone through your project description. I am interested in your project, you can chat me up for further discussion about the project in the private chat. Hoping to hear from you soon. Thanks.