Skip to content

Commit

Permalink
Docs: Improve clarity for bytes.hex() (GH-95257)
Browse files Browse the repository at this point in the history
(cherry picked from commit 860fa35)

Co-authored-by: Tim Burke <tim.burke@gmail.com>
  • Loading branch information
miss-islington and tipabu committed Aug 30, 2022
1 parent 2e9f29e commit d9d0d09
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Doc/library/stdtypes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2548,9 +2548,10 @@ data and are closely related to string objects in a variety of other ways.

If you want to make the hex string easier to read, you can specify a
single character separator *sep* parameter to include in the output.
By default between each byte. A second optional *bytes_per_sep*
parameter controls the spacing. Positive values calculate the
separator position from the right, negative values from the left.
By default, this separator will be included between each byte.
A second optional *bytes_per_sep* parameter controls the spacing.
Positive values calculate the separator position from the right,
negative values from the left.

>>> value = b'\xf0\xf1\xf2'
>>> value.hex('-')
Expand Down

0 comments on commit d9d0d09

Please sign in to comment.