We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adafruit CircuitPython 9.1.4 on 2024-09-17; Raspberry Pi Pico with rp2040
a = b'A' * 32 print(a.count(b'A')) print(a.count(65)) #A is ascii character 65
The count function works with the byte string but not the integer. See:
32 Traceback (most recent call last): File "code.py", line 3, in <module> TypeError: can't convert 'int' object to str implicitly
In contrast, with cPython 3.12.6 in win32, the count works with both the integer and the byte string:
>>> a = b'A' * 32 >>> a.count(b'A') 32 >>> a.count(65) 32
https://docs.python.org/3/library/stdtypes.html#bytes.count states
The subsequence to search for may be any bytes-like object or an integer in the range 0 to 255.
The text was updated successfully, but these errors were encountered:
This behavior also exists in MicroPython, from which we take a lot of this kind of core functionality.
Sorry, something went wrong.
No branches or pull requests
CircuitPython version
Code/REPL
Behavior
The count function works with the byte string but not the integer. See:
Description
In contrast, with cPython 3.12.6 in win32, the count works with both the integer and the byte string:
Additional information
https://docs.python.org/3/library/stdtypes.html#bytes.count states
The text was updated successfully, but these errors were encountered: