Browse Source

Struct

pull/9/head
Jure Šorn 5 years ago
parent
commit
a302202e61
1 changed files with 4 additions and 4 deletions
  1. 8
      README.md

8
README.md

@ -868,15 +868,15 @@ Struct
------ ------
**This module performs conversions between Python values and C struct represented as Python Bytes object.** **This module performs conversions between Python values and C struct represented as Python Bytes object.**
```python ```python
<Bytes> = struct.pack('<format>', <value_1> [, <value_2>, ...])
<tuple> = struct.unpack('<format>', <Bytes>)
from struct import pack, unpack, calcsize
``` ```
### Example
```python ```python
>>> from struct import pack, unpack, calcsize
<Bytes> = pack('<format>', <value_1> [, <value_2>, ...])
<tuple> = unpack('<format>', <Bytes>)
``` ```
### Example
```python ```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'

Loading…
Cancel
Save