Search snippets
Browse Code Answers
FAQ
Usage docs
Log In
Sign Up
Home
Python
check how many times a substring appears in a string
pinksy
Programming language:
Python
2021-07-05 08:51:37
0
Q:
check how many times a substring appears in a string
Douglas McClure
Code:
Python
2021-06-05 19:40:44
a = '128532012' print(a.count('0')) #Prints: 1 print(a.count('12')) #Prints: 2
1
Tags
string
app
check
time
many
sub
how
Related
how to Write the regular expression that will match all non-digit characters of a string.
Write a Python program that will ask the user to input a string (containing exactly one word). Then your program should print a subsequent substring of the given string.
Return the number of times that the string "hi" appears anywhere in the given string. python
check frequency of consecutive character in string python
New to Communities?
Join the community