I am very new to Python.
I would like to work on an existing file (exist_file
) and, in addition, to create a copy of it. The problem is, when I create the copy of the file, the exist_file
becomes empty.
exist_file = open('some_pass/my_file.txt', 'r')
print exist_file.read() # Here the file is successfully printed
copy_of_file = open('new_copied_file.txt', 'w')
copy_of_file.write(exist_file.read())
print exist_file.read() # Here the file is empty
Why exist_file
is empty?