- Code: Select all
from sys import argv
from os.path import exists
script, from_file, to_file = argv
print "Copying from %s to %s" % (from_file, to_file)
# We could do these two on one line too, how?
input = open(from_file)
indata = input.read()
print "The input file is %d bytes long" % len(indata)
print "Does the output file exists? %r" % exists(to_file)
print "Ready, hit RETURN to continue, CTRL-C to abort."
output = open(to_file, 'w')
print "Alright, all done."
From the above script, is it possible that I shortened them into just a line by removing the features? Thanks for your guides!