11import argparse
22
3- parser = argparse .ArgumentParser (prog = "wc" ,
4- description = "Count lines, words, and characters in one or more files." )
3+ parser = argparse .ArgumentParser (
4+ prog = "wc" , description = "Count lines, words, and characters in one or more files."
5+ )
56
6- parser .add_argument ("-c" ,action = "store_true" ,help = "Count the number of characters." )
7- parser .add_argument ("-w" ,action = "store_true" , help = "Count the number of words." )
8- parser .add_argument ("-l" ,action = "store_true" ,help = "Count the number of lines." )
9- parser .add_argument ("paths" ,nargs = "+" ,help = "Path(s) to the file(s) to process." )
7+ parser .add_argument ("-c" , action = "store_true" , help = "Count the number of characters." )
8+ parser .add_argument ("-w" , action = "store_true" , help = "Count the number of words." )
9+ parser .add_argument ("-l" , action = "store_true" , help = "Count the number of lines." )
10+ parser .add_argument ("paths" , nargs = "+" , help = "Path(s) to the file(s) to process." )
1011
1112
12- total_results = {
13-
14- }
13+ total_results = {}
1514
1615
17- args = parser .parse_args ()
18- paths = args .paths ;
16+ args = parser .parse_args ()
17+ paths = args .paths
1918no_flags = not args .c and not args .w and not args .l
2019
2120for path in paths :
4443
4544if len (paths ) > 1 :
4645 print (" " .join (map (str , total_results .values ())), "total" )
47-
0 commit comments