Browse Source

Bytes and Struct

pull/3/head
Jure Šorn 6 years ago
parent
commit
d6b7e80850
1 changed files with 9 additions and 2 deletions
  1. 11
      README.md

11
README.md

@ -654,16 +654,23 @@ Bytes
``` ```
```python ```python
<Bytes> = b''.join(<list_of_bytes>)
<Bytes> = b''.join(<list_of_Bytes>)
``` ```
### Read Bytes from file:
### Read Bytes from file
```python ```python
def read_bytes(filename): def read_bytes(filename):
with open(filename, 'rb') as file: with open(filename, 'rb') as file:
return file.read() return file.read()
``` ```
### Write Bytes to File
```python
def write_bytes(filename, bytes):
with open(filename, 'wb') as file:
file.write(bytes)
```
Struct Struct
------ ------
**This module performs conversions between Python values and C structs represented as Python bytes objects:** **This module performs conversions between Python values and C structs represented as Python bytes objects:**

Loading…
Cancel
Save