-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathex17.py
More file actions
33 lines (24 loc) · 655 Bytes
/
ex17.py
File metadata and controls
33 lines (24 loc) · 655 Bytes
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
27
28
29
30
31
32
33
#!/bin/env python
# -*- coding: utf-8 -*-
#:Tital: ex17.py
#:synopsis: ex17.py
#:Date: 2012-12-25
#:Version: 1.0
#:Author: lovvvve
#:Options:
from sys import argv
from os.path import exists
scripts,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?
in_file=open(from_file)
indata=in_file.read()
print "The input file is %d byte long" % len(indata)
print "Does the output file exist? %r" % exists(to_file)
print "Ready,hit RETURN to contiue,CTRL-C to abort."
raw_input()
out_file=open(to_file,'w')
out_file.write(indata)
print "Alright, all done."
out_file.close
in_file.close