mirror of
https://github.com/python/cpython.git
synced 2026-01-06 15:32:22 +00:00
Move around example in to_bytes() to avoid confusion (#101595)
Moves an example to be closer to the sentence that refers to it.
This commit is contained in:
parent
a74cd3ba5d
commit
5da379ca7d
1 changed files with 4 additions and 2 deletions
|
|
@ -530,12 +530,14 @@ class`. In addition, it provides a few more methods:
|
|||
is ``False``.
|
||||
|
||||
The default values can be used to conveniently turn an integer into a
|
||||
single byte object. However, when using the default arguments, don't try
|
||||
to convert a value greater than 255 or you'll get an :exc:`OverflowError`::
|
||||
single byte object::
|
||||
|
||||
>>> (65).to_bytes()
|
||||
b'A'
|
||||
|
||||
However, when using the default arguments, don't try
|
||||
to convert a value greater than 255 or you'll get an :exc:`OverflowError`.
|
||||
|
||||
Equivalent to::
|
||||
|
||||
def to_bytes(n, length=1, byteorder='big', signed=False):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue