Answers for "You will be provided a file path for input I, a file path for output O, a string S, and a string T."

1

You will be provided a file path for input I, a file path for output O, a string S, and a string T. Read the contents of I, replacing each occurrence of S with T and write the resulting information to file O. You should replace O if it already exists.

# You will be provided a file path for input I, a file path for output O, a string S, and a string T.
# Read the contents of I, replacing each occurrence of S with T and write the resulting information to file O.
# You should replace O if it already exists.

file1 = open(I, 'r')
Icontent = file1.read()
editedData = Icontent.replace(S, T)
file2 = open(O, 'w')
file2.write(editedData)
file1.close()
file2.close()
Posted by: Guest on February-12-2020
0

You will be provided a file path for input I, a file path for output O, a string S, and a string T.

file1 = open(I, 'r')
Icontent = file1.read()
editedData = Icontent.replace(S, T)
file2 = open(O, 'w')
file2.write(editedData)
file1.close()
file2.close()
Posted by: Guest on June-09-2020

Code answers related to "You will be provided a file path for input I, a file path for output O, a string S, and a string T."

Python Answers by Framework

Browse Popular Code Answers by Language