How can I count the number of characters at the start/end of a string in Python?
For example, if the string is
'ffffhuffh'
How would I count the number of fs at the start of the string? The above string with a f should output 4.
str.count is not useful to me as a character could be in the middle of the string.