Getting modulo of bytes-number in Python -


when working in python, let's have long bytes object. want modulo number. example, have bytes object b'hi' , want modulo 3, result 26729 % 3 == 2. (the bytes object seen 1 big number.)

how do in python? (preferably python 3.) i'm hoping there's relatively elegant way don't have manually compute number.

>>> int.from_bytes(b'hi', 'big', signed=false) % 3 2 

Comments

Popular posts from this blog

css - I want to align grid in center -

Contact Form PHP Email Script -

python - SWIG function not printing output -