0

In the following how to count the number of times that __TEXT__ appears in the variable sing python

    a="This is __TEXT__ message to test __TEXT__ message"
Hulk
  • 32,860
  • 62
  • 144
  • 215
  • 4
    possible duplicate of [Count occurrence of a character in a Python string](http://stackoverflow.com/questions/1155617/count-occurrence-of-a-character-in-a-python-string) – kennytm Aug 13 '10 at 07:18

1 Answers1

4

a.count("__TEXT__")

Eric Snow
  • 1,198
  • 8
  • 21