So, I’m on this chapter and another post showed me how to reduce the code to a more compressed version
from sys import argv
from os.path import exists
script, from_file, to_file = argv
(open(to_file, 'w').write(open(from_file).read()))
My question on line 6 is why I am not using the same format that I use open(to_file,'w')for the part that says:open(from_file).read()
Is it possible to use something similar, for example, open(from_file, 'r')in this part of the code? Why or why not?
source
share