blob: d2a8b50aaf1ac1b39fe4494e775b35fdc34936ee (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#!/usr/bin/python
import os
import sys
def wordsplit(line):
list = []
word = ""
for c in line:
if c.isspace():
if len(word) > 0:
list.append(word)
word = ""
else:
word += c
if len(word) > 0:
list.append(word)
return list
def main():
n = 0
for a in sys.argv[1:]:
f = open(a)
for line in f:
words = wordsplit(line)
n += len(words)
f.close()
print "%d\n" % n
if __name__ == "__main__":
main()
|