bytes.get
bytes.get
Function
Read the byte at the specified index.
Syntax
bytes(value).get(index)
Parameters
| Parameters | Type | Required | Default value | Description |
|---|---|---|---|---|
| index | Int | Yes | None | The byte index. Supports reading negative numbers from the tail. |
Return value
| Type | Description |
|---|---|
| Int/Empty | Returns an integer from 0 to 255 when the subscript exists; returns empty when the subscript is out of bounds. |
Code Example
data = bytes([66, 84]) result = data.get(1) // Output: 84 print result
Notes
-
data[0]can also read bytes; out of bounds also returnsempty.