count of sub string in string in python code example Example: how to count substring in a string in python count = string.count(substring)