czwartek, 28 listopada 2013

from file 2 file python

#!/usr/bin/python

from sys import argv
from os.path import exists

script, from_file, to_file = argv
try:
    print "copying from %s to %s" % (from_file, to_file)
    print "check if first file is excist"
    in_file = open(from_file)
    indata = in_file.read()

    print "The input file is %d bytes long" %len(indata)
    raw_input()
    out_file = open(to_file, 'w')
    out_file.write(indata)
    print "all done"
    out_file.close()
    in_file.close()
except IOError:
    print "I/O Error"

Brak komentarzy:

Prześlij komentarz