Word for English words in the statistics are also very good, you may wish to try. If Word is not installed and you are also a program member, you can use my code. Pass the test, Word's statistic result is 18674, the software statistic result is 18349, the difference is less than 2%, can serve as a reference.
The code is as follows:
Copy Code code as follows:
#-*-Coding:utf-8-*-
Import Os,sys
info = OS.GETCWD () #获取当前文件名称
Fin = open (U ' Google C + + programming code specification. txt ')
info = Fin.read ()
Alist = Info.split (') # to divide the article by space
Fout = open (U ' count.txt ', ' W ')
Fout.write (' \ n '. Join (alist) # can see the same effect through the line number of the text file
# #fout. Write ('%s '% alist)
Fout.close ()
Allen = Len (alist) # total number of words
Nulen = number of spaces in Alist.count (') #
print "Words ' number is", Allen
Print "null number is", Nulen
Print "Poor words number is", Allen-nulen # actual words
Fin.close ()