Browse Source

Struct

pull/9/head
Jure Šorn 6 years ago
parent
commit
cb21e6ad11
1 changed files with 6 additions and 0 deletions
  1. 6
      README.md

6
README.md

@ -875,13 +875,19 @@ Struct
### Example ### Example
```python ```python
>>> from struct import pack, unpack, calcsize >>> from struct import pack, unpack, calcsize
```
```python
>>> pack('hhl', 1, 2, 3) >>> pack('hhl', 1, 2, 3)
b'\x00\x01\x00\x02\x00\x00\x00\x03' b'\x00\x01\x00\x02\x00\x00\x00\x03'
```
```python
>>> unpack('hhl', b'\x00\x01\x00\x02\x00\x00\x00\x03') >>> unpack('hhl', b'\x00\x01\x00\x02\x00\x00\x00\x03')
(1, 2, 3) (1, 2, 3)
```
```python
>>> calcsize('hhl') >>> calcsize('hhl')
8 8
``` ```

Loading…
Cancel
Save