diff -r 6b1df8905012 Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst Mon Oct 10 00:24:34 2016 +0000 +++ b/Doc/library/stdtypes.rst Mon Oct 31 03:58:17 2016 +0900 @@ -482,13 +482,13 @@ b'\x04\x00' >>> (1024).to_bytes(10, byteorder='big') b'\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00' >>> (-1024).to_bytes(10, byteorder='big', signed=True) b'\xff\xff\xff\xff\xff\xff\xff\xff\xfc\x00' >>> x = 1000 - >>> x.to_bytes((x.bit_length() // 8) + 1, byteorder='little') + >>> x.to_bytes((x.bit_length() + 7) // 8, byteorder='little') b'\xe8\x03' The integer is represented using *length* bytes. An :exc:`OverflowError` is raised if the integer is not representable with the given number of bytes.