¡@

Home 

python Programming Glossary: padmultiple

Is there a faster way to convert an arbitrary large integer to a big endian sequence of bytes?

http://stackoverflow.com/questions/4358285/is-there-a-faster-way-to-convert-an-arbitrary-large-integer-to-a-big-endian-sequ

either direction as the accepted answer def packl lnum padmultiple 1 Packs the lnum which must be convertable to a long into a.. to a long into a byte string 0 padded to a multiple of padmultiple bytes in size. 0 means no padding whatsoever so that packing.. of the passed in long. if lnum 0 return b' 0' padmultiple elif lnum 0 raise ValueError Can only convert non negative numbers...