>>> help(bytearray.count)
Help on method_descriptor:
count(...)
B.count(sub[, start[, end]]) -> int
Return the number of non-overlapping occurrences of subsection sub in
bytes B[start:end]. Optional arguments start and end are interpreted
as in slice notation.
>>> b = bytearray(b'abcd')
>>> b
bytearray(b'abcd')
>>> b.count('a')
Traceback (most recent call last):
File "<console>", line 1, in <module>
TypeError: Type str doesn't support the buffer API
Question> How to use count for bytearray?
You pretty clearly need to pass another byte array to
b.count: