3
Contributors
2
Replies
3
Views
10 Years
Discussion Span
Last Post by vegaseat
0

you should read the docs more. also googling with "Python word count" will show you some links to what you are looking for.

0

Searching our own Python snippet section there are several hits under 'wordcount' and word frequency. These snippets are probably more complex than what you need, so here is a very simple way to do it ...

# Chinese wisdom ...
str1 = """Man who run in front of car, get tired.
Man who run behind car, get exhausted."""
 
print str1.count('Man')  # 2

BTW, Google result --> about 1,110,000 for python word count . That should keep you busy for the next ten years.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.