If I want to convert between integers and characters, I use chr
and ord
:
>>> chr(10)
'\n'
>>> ord('$')
36
However, I need to do a test with binary strings , something new in Python 3, and I - which I only have experience with Python 2 - I have no idea how to do:
# O que eu sei
teste(b'\x00')
teste(b'\x01')
teste(b'\x02')
...
teste(b'\xff')
# O que eu quero
for i in range(256)
teste(???)