Count Substring Occurrences

Count how many times a substring appears in a string (non-overlapping).

Code

General
str.count(substring)

Parameters

The string to search in

The substring to count

Server

More Python Snippets