1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
from sys import argv
from os.path import exists
py_file, original_txt_file, copy_txt_file = argv
raw_content = open(original_txt_file)
pure_content = raw_content.read()
print("The pure content is :\n", pure_content)
print("The original file is %d bytes long." %len(pure_content))
print("Does the empty copy file exist ? %r" %exists(copy_txt_file))
print("Hit ENTER to continue, CTRL+C to abort.")
input("So ?")
print("Copying from %s to %s" %(original_txt_file, copy_txt_file))
raw_copy_content = open(copy_txt_file, 'r+')
raw_copy_content.write(pure_content)
raw_copy_content.seek(0)
pure_copy_content = raw_copy_content.read()
print(pure_copy_content)
raw_content.close()
raw_copy_content.close() |
Partager