Skip to content

Commit 02de813

Browse files
committed
Create dictionary
1 parent 4b88392 commit 02de813

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

  • implement-shell-tools/wc

implement-shell-tools/wc/wc.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import argparse
2+
3+
parser = argparse.ArgumentParser(prog="wc", description="Print newline, word, and byte counts for each FILE, and a total line if more than one FILE is specified.")
4+
parser.add_argument("-w", "--words", help="print the word counts", action="store_true")
5+
parser.add_argument("-l", "--line", help="print the newline counts", action="store_true")
6+
parser.add_argument("-c", "--bytes", help="print the byte counts", action="store_true")
7+
parser.add_argument("path", help="The file path", nargs="+")
8+
9+
args = parser.parse_args()
10+
11+
dict = {}
12+
13+
for file in args.path:
14+
f = open(file)
15+
text = []
16+
text.append(f.read())
17+
dict[file] = text
18+
19+
for f in dict:
20+
print(dict[f])
21+
22+
# print(dict)

0 commit comments

Comments
 (0)