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 466c007 commit f0dc6b0Copy full SHA for f0dc6b0
1 file changed
implement-shell-tools/wc/wc.py
@@ -13,20 +13,21 @@
13
bytes = 0
14
15
dict = {}
16
+adict = {}
17
18
for file in args.path:
19
f = open(file)
- # text = []
20
- # text.append(f.read().split("\n"))
21
- # print(f.read().split("\n"))
22
dict[file] = f.read().split("\n")
23
-# print(dict)
+ adict[file] = f.read()
+
+for file in args.path:
24
+ f = open(file)
25
26
27
for f in dict:
28
word_per_line = 0
29
byte_per_line = 0
- for l in dict[f]:
30
+ for l in adict[f]:
31
word_per_line += len(l.split())
32
byte_per_line += len(l.encode("utf-8"))
- # print(byte_per_line)
- print(str(len(dict[f]) - 1) + " " + str(word_per_line) + " " + f)
-
33
+ print(" " + str(len(dict[f]) - 1) + " " + str(word_per_line) + " " + str(byte_per_line) + " " + f)
0 commit comments