1

how do you check if a string has more than one specific character in python. Example The string, 'mood' would clearly have two 'o' characters

blhsing
  • 77,832
  • 6
  • 59
  • 90

1 Answers1

3

You can use the str.count method:

>>> 'mood'.count('o') > 1
True
>>>
blhsing
  • 77,832
  • 6
  • 59
  • 90