There was an error while loading. Please reload this page.
1 parent 575f0bf commit d5a3942Copy full SHA for d5a3942
1 file changed
implement-shell-tools/wc/wc.py
@@ -40,20 +40,20 @@
40
41
line_count = len(lines)
42
totals["l"] += line_count
43
- output_str += f"\t{line_count}"
+ output_str += f"{line_count:8}"
44
45
if (args.w):
46
word_count = 0
47
for line in lines:
48
# python string.split splits on any white space
49
word_count += len(line.split())
50
totals["w"] += word_count
51
- output_str += f"\t{word_count}"
+ output_str += f"{word_count:8}"
52
53
if (args.c):
54
bytes = os.path.getsize(path)
55
totals["c"] += bytes
56
- output_str += f"\t{bytes}"
+ output_str += f"{bytes:8}"
57
58
output_str += f" {path}"
59
print(output_str)
@@ -63,7 +63,7 @@
63
if val != 0}
64
total_str = ""
65
for v in res.values():
66
- total_str += f"\t{v}"
+ total_str += f"{v:8}"
67
68
total_str += " total"
69
print(total_str)
0 commit comments