Bytes indexing returns an int

Serhiy Storchaka storchaka at gmail.com
Tue Jan 7 14:48:24 EST 2014


07.01.14 18:12, Steven D'Aprano написав(ла):
> In Python 2.7, if you have a
> chunk of binary data, you can easily do this:
>
> data = b'\xE1\xE2\xE3\xE4'
> data[0] == b'\xE1'
>
> and it returns True just as expected.

data[0] == b'\xE1'[0] works as expected in both Python 2.7 and 3.x.





More information about the Python-list mailing list