File tree 1 file changed +8
-3
lines changed
1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change 14
14
utility. Compatible with Python 3.6 or higher.
15
15
16
16
Syntax:
17
- python3 cat.py [filename1, filename2, etcetera]
18
- Separate filenames with commas and not spaces!
17
+ python3 cat.py [filename1 filename2 etcetera]
18
+ Separate filenames with spaces as usual.
19
19
20
20
David Costell (DontEatThemCookies on GitHub)
21
21
v1 - 02/06/2022
22
22
"""
23
23
import sys
24
24
25
+
25
26
def with_files (files ):
26
27
"""Executes when file(s) is/are specified."""
27
28
file_contents = []
@@ -38,6 +39,7 @@ def with_files(files):
38
39
for contents in file_contents :
39
40
sys .stdout .write (contents )
40
41
42
+
41
43
def no_files ():
42
44
"""Executes when no file(s) is/are specified."""
43
45
try :
@@ -51,13 +53,16 @@ def no_files():
51
53
except EOFError :
52
54
exit ()
53
55
56
+
54
57
def main ():
55
58
"""Entry point of the cat program."""
56
59
try :
57
60
# Read the arguments passed to the program
58
- with_files (sys .argv [1 ].strip ().split ("," ))
61
+ file = sys .argv [1 :]
62
+ with_files (file )
59
63
except IndexError :
60
64
no_files ()
61
65
66
+
62
67
if __name__ == "__main__" :
63
68
main ()
You can’t perform that action at this time.
0 commit comments