How do I do this without string.count()
, because it is listed as deprecated in Python v2.7.3 documentation?
I am unable to find what I should use instead.
EDIT: The question originally stated that str.count()
was deprecated but that is incorrect and misleading. See https://mcmap.net/q/1861195/-what-is-the-preferred-way-to-count-the-number-of-ocurrences-of-a-certain-character-in-a-string for explanation
string.count
, which is deprecated (alongside most of the rest of thestring
module)? – Kaphstr
andstring
are different. The former is the type of strings in python, the latter a module that handles string-related things. – Overweigh