File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1212words = 0
1313bytes = 0
1414
15+ l = True
16+ w = True
17+ c = True
18+
1519dict = {}
1620adict = {}
1721
2428 f = open (file )
2529 adict [file ] = f .read ()
2630
31+ def print_helper (line , word , byte , file_name ):
32+ text = [" " ]
33+ if l == True :
34+ text .append (str (line ))
35+ text .append (" " )
36+ if w == True :
37+ text .append (str (word ))
38+ text .append (" " )
39+ if c == True :
40+ text .append (str (byte ))
41+ text .append (" " )
42+ text .append (file_name )
43+ print ("" .join (text ))
44+
2745for f in dict :
2846 word_per_line = 0
2947 byte_per_line = 0
30- for l in adict [f ]:
31- word_per_line += len (l .split ())
32- byte_per_line += len (l .encode ("utf-8" ))
33- print (" " + str (len (dict [f ]) - 1 ) + " " + str (word_per_line ) + " " + str (byte_per_line ) + " " + f )
48+ for line in dict [f ]:
49+ word_per_line += len (line .split ())
50+ for line in adict [f ]:
51+ byte_per_line += len (line .encode ("utf-8" ))
52+ lines += len (dict [f ]) - 1
53+ words += word_per_line
54+ bytes += byte_per_line
55+ print_helper (len (dict [f ]) - 1 , word_per_line , byte_per_line , f )
56+
57+ if len (args .path ) > 1 :
58+ print_helper (lines , words , bytes , "total" )
You can’t perform that action at this time.
0 commit comments