If you want to find the count of an individual word, just use count
:
input_string.count("Hello")
Use collections.Counter
and split()
to tally up all the words:
from collections import Counter
words = input_string.split()
wordCount = Counter(words)
More Related Contents:
- Does the django-rest-framework provide an admin site to manage models?
- Swapping variable places inside if throws an error
- Text parsing and retrieval
- Understanding generators in Python
- How to run functions in parallel?
- Comprehensive beginner’s virtualenv tutorial? [closed]
- How to install python3 version of package via pip on Ubuntu?
- Putting a simple if-then-else statement on one line [duplicate]
- sort csv by column
- SQLAlchemy IN clause
- How can I multiply all items in a list together with Python?
- A very simple multithreading parallel URL fetching (without queue)
- Using Colormaps to set color of line in matplotlib
- Which seeds have to be set where to realize 100% reproducibility of training results in tensorflow?
- Safest way to convert float to integer in python?
- Python Pip install Error: Unable to find vcvarsall.bat. Tried all solutions [duplicate]
- How to create a system tray popup message with python? (Windows)
- Change grid interval and specify tick labels in Matplotlib
- Illegal instruction (core dumped) after running import tensorflow
- Why does 1 == True but 2 != True in Python? [duplicate]
- Is there a Python language specification?
- replacing only single instances of a character with python regexp
- re-using an entity’s ID for other entities of different kinds – sane idea?
- IntegrityError when inserting data in an association table using SQLAlchemy
- Search a list of dictionaries in Python
- How to install pygame? [duplicate]
- append dictionary to data frame
- How to get largest possible precision? (Python – Decimal)
- Fast way to copy dictionary in Python
- Find a value in a list [duplicate]