Browse Source

Bytes and Struct

pull/3/head
Jure Šorn 6 years ago
parent
commit
70b9f55246
1 changed files with 11 additions and 4 deletions
  1. 15
      README.md

15
README.md

@ -637,20 +637,27 @@ raise IOError("input/output error")
Bytes
-----
**Bytes objects are immutable sequences of single bytes:**
**Bytes objects are immutable sequences of single bytes.**
#### Str:
```python
# str
<Bytes> = b'<str>'
<str> = <Bytes>.decode('utf-8')
```
# int
#### Int:
```python
<Bytes> = <int>.to_bytes(<length>, byteorder='big|small', signed=False)
<int> = int.from_bytes(<Bytes>, byteorder='big|small', signed=False)
```
# hex
#### Hex:
```python
<Bytes> = bytes.fromhex(<hex>)
<hex> = <Bytes>.hex()
```
```python
<Bytes> = b''.join(<list_of_bytes>)
```

Loading…
Cancel
Save