File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed
Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change 66"""
77
88import argparse
9+ import os
910
1011
1112# --------------------------------------------------
@@ -31,15 +32,20 @@ def main():
3132 """Process the arguments"""
3233
3334 args = get_args ()
34- outfile_arg = args .outfile
35- input_arg = args .input
3635
37- if outfile_arg != "" :
38- out_fh = open (outfile_arg , "wt" )
39- out_fh .write (input_arg .upper ())
36+ if os .path .isfile (args .input ):
37+ in_fh = open (args .input )
38+ input_text = in_fh .read ()
39+ in_fh .close ()
40+ else :
41+ input_text = args .input
42+
43+ if args .outfile != "" :
44+ out_fh = open (args .outfile , "wt" )
45+ out_fh .write (input_text .upper ())
4046 out_fh .close ()
4147 else :
42- print (input_arg .upper ())
48+ print (input_text .upper ())
4349
4450
4551# --------------------------------------------------
You can’t perform that action at this time.
0 commit comments