138k views
3 votes
how to write a program that will copy the contents of a text file called input.txt to a file called copied.text After the program runs the contents of both files should be the same. You will need to manually create the input file. inc

User Lateefah
by
6.5k points

1 Answer

6 votes

In python:

f = open("input.txt", 'r')

copy = open("copied.txt", 'a')

txt = ""

for i in f.readlines():

txt += i

copy.write(txt)

f.close()

copy.close()

I hope this helps!

User Crazy Dino
by
7.7k points