Skip to content

Commit 516af11

Browse files
committed
fixing bug and improving code
1 parent 9b645e6 commit 516af11

File tree

1 file changed

+7
-3
lines changed
  • implement-shell-tools/wc

1 file changed

+7
-3
lines changed

implement-shell-tools/wc/wc.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
parser.add_argument("path",nargs="+")
99
args=parser.parse_args()
1010

11-
print(args)
11+
1212
paths=args.path
1313
words_count=0
1414
total_lines=0
@@ -34,5 +34,9 @@
3434
(f"{bytes_count:<5}" if args.c else "")+
3535
f"{file:<20}")
3636
words_count=0
37-
38-
print(f"{total_lines:<5}{total_words:<5}{total_bytes:<5}total")
37+
38+
if len(paths)>1 :
39+
print((f"{total_lines:<5}" if args.l else "")+
40+
(f"{total_words:<5}" if args.w else "")+
41+
(f"{total_bytes:<5}" if args.c else "")+
42+
"total")

0 commit comments

Comments
 (0)