Skip to content

Commit 4aaeade

Browse files
committed
added a couple more solutions
1 parent d7d6c6f commit 4aaeade

2 files changed

Lines changed: 33 additions & 0 deletions

File tree

‎Solutions/Session04/copy_file.py‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env python
2+
3+
"""
4+
Very simple script to copy a file
5+
"""
6+
7+
import sys
8+
9+
source, dest = sys.argv[1:3]
10+
11+
infile = open(source, 'rb')
12+
outfile = open(dest, 'wb')
13+
14+
outfile.write(infile.read())
15+
infile.close()
16+
outfile.close()
17+
18+
## or as a one-liner:
19+
# open(dest, 'wb').write(open(source, 'rb').read())
20+
21+

‎Solutions/Session04/print_paths.py‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env python
2+
3+
"""
4+
very simple script to print the full paths in the current dir
5+
"""
6+
7+
import os
8+
9+
files = os.listdir('.')
10+
for name in files:
11+
print os.path.abspath(name)
12+

0 commit comments

Comments
 (0)