We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 94a559e commit 83c45bbCopy full SHA for 83c45bb
students/robert/Session 5/Paths and File Processing.py
@@ -0,0 +1,25 @@
1
+#!/usr/bin/python
2
+
3
4
+#Find and print file locations
5
+import pathlib
6
+pth = pathlib.Path('./')
7
+abpth = pth.absolute()
8
+for fn in pth.iterdir():
9
+ print(str(abpth) + '\\' + str(fn))
10
11
+# Copy file to designated location
12
+file_name = input ('file_name with file type: ')
13
+#'classinfo.txt'
14
+out_loc = input('Copy location (/): ')
15
+#'/Python Class/Copied Files/'
16
+with open(file_name, 'r') as f:
17
+ read_data = f.read()
18
+ f.closed
19
+#'/Python Class/Copied Files/classinfo_copy.txt'
20
+ out_file = out_loc + "/" + file_name
21
+ with open(out_file, 'w') as f1:
22
+ for line in read_data:
23
+ f1.write(line)
24
25
0 commit comments