We’re asked to shorten the script… this is what I got thus far… Am I still able to make it one line regardless?
import sys
from os.path import exists
script, from_file, to_file = sys.argv
#one liner???
if exists(to_file) == True:
print(f"Copying {to_file} with {from_file}\a")
with open(from_file) as in_file:
indata = in_file.read()
out_file = open(to_file, ‘w’)
out_file.write(indata)
out_file.close()
in_file.close()
#this is about the shortest I am able to get it. But if I’m able to shorten it, any suggestions or tips would help