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

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

android - IBM Worklight 6.1 [Application Error] There was a network error (file:///android_asset/www/index.html) -