py3k: converting int to bytes

John Machin sjmachin at lexicon.net
Fri Feb 25 03:25:03 CET 2011


On Feb 25, 4:39 am, Terry Reedy wrote:

> Note: an as yet undocumented feature of bytes (at least in Py3) is that
> bytes(count) == bytes()*count == b'\x00'*count.

Python 3.1.3 docs for bytes() say same constructor args as for
bytearray(); this says about the source parameter: """If it is an
integer, the array will have that size and will be initialized with
null bytes"""



More information about the Python-list mailing list