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
  • 70,627
  • 6
  • 41
  • 76

1 Answers1

3

You can use the str.count method:

>>> 'mood'.count('o') > 1
True
>>>
blhsing
  • 70,627
  • 6
  • 41
  • 76