bytes.to_hex
bytes.to_hex
Function
Convert Bytes to lowercase hexadecimal text.
Syntax
bytes(value).to_hex(separator)
Parameters
| Parameters | Type | Required | Default value | Description |
|---|---|---|---|---|
| separator | String | No | Empty string | The separator between each byte. |
Return value
| Type | Description |
|---|---|
| String | Hexadecimal text. |
Code Example
data = bytes([66, 84]) text = data.to_hex(' ') // Output: 42 54 print text
Notes
-
string(bytes(...))andbytes(...).to_string()return undelimited hexadecimal text by default.