Skip to content

Commit 1a67f3d

Browse files
author
joy
committed
kyclark#5-2 joy.y
1 parent 050bca1 commit 1a67f3d

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

05_howler/howler.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,23 +26,25 @@ def get_args():
2626
help='Output filename',
2727
metavar='str',
2828
type=argparse.FileType('wt'),
29-
default='')
29+
default=None)
3030

31-
return parser.parse_args()
31+
args = parser.parse_args()
32+
33+
if os.path.isfile(args.input):
34+
args.input = open(args.input).read().rstrip()
35+
36+
return args
3237

3338

3439
# --------------------------------------------------
3540
def main():
3641
"""Make a jazz noise here"""
3742

3843
args = get_args()
39-
str_args = args.input
44+
str_args = args.input.upper()
4045
outfile_args = args.outfile
4146

42-
if os.path.isfile(args.input):
43-
str_args = open(str_args).read()
44-
45-
print(f'{str_args.upper()}', file=outfile_args) if outfile_args else print(f'{str_args.upper()}')
47+
print(f'{str_args}', file=outfile_args) if outfile_args else print(f'{str_args}')
4648

4749

4850
# --------------------------------------------------

0 commit comments

Comments
 (0)