[Python-ideas] Add an option for delimiters in bytes.hex()
robert.hoelzl at posteo.de
robert.hoelzl at posteo.de
Mon May 1 03:19:01 EDT 2017
The bytes.hex() function is the inverse function of Bytes.fromhex().
But fromhex can process spaces (which is much more readable), while hex() provides no way to include spaces.
My proposal would be to add an optional delimiter, that allows to specify a string that will be inserted between the digit pairs of a byte:
def hex(self, delimiter=‘‘): …
This would allow to write:
assert b’abc‘.hex(‘ ‘) == ’61 62 63‘
Gesendet von Mail für Windows 10
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20170501/d463313d/attachment.html>
More information about the Python-ideas
mailing list