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 c70d7d9 commit d996f5bCopy full SHA for d996f5b
1 file changed
implement-shell-tools/wc/wc.py
@@ -104,10 +104,10 @@
104
args = parser.parse_args()
105
106
def counter(item):
107
- lines = len(item.trim().split("\n"))
108
- words = item.split()
+ lines = len(item.strip().split("\n"))
+ words = len(item.split())
109
characters = len(item)
110
- return {lines, words, characters}
+ return {"lines": lines, "words": words, "characters": characters}
111
112
113
total_lines = 0
@@ -121,7 +121,7 @@ def counter(item):
121
content = f.read()
122
stats = counter(content)
123
if args.line:
124
- print(f"{lines} {path}")
+ print(f"{stats[lines]} {path}")
125
elif args.word:
126
print()
127
elif args.char:
0 commit comments