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 518eafb commit 40e5125Copy full SHA for 40e5125
implement-shell-tools/wc/wc.py
@@ -5,6 +5,8 @@
5
6
parser.add_argument("-l", action="store_true", help="Print line count")
7
8
+parser.add_argument("-w", action="store_true", help="Print word count")
9
+
10
parser.add_argument("files", nargs="+", help="Files to process")
11
12
args = parser.parse_args()
@@ -34,13 +36,20 @@
34
36
if args.l:
35
37
print(f"{lines:} {file}")
38
39
+ elif args.w:
40
+ print(f"{words:} {file}")
41
42
else:
43
print(f"{lines:>3} {words:>3} {tbytes:>3} {file}") # to print data from per life
44
45
#to print total output
46
if multiple_files:
47
48
print(f"{total_lines:} total")
49
50
51
+ print(f"{total_words:} total")
52
53
54
print(f"{total_lines:>3} {total_words:>3} {total_bytes:>3} total")
55
0 commit comments