mirror of
https://github.com/sascha-hemi/pycom-documentation.git
synced 2026-03-21 19:06:45 +01:00
zlib example minor fixes (#433)
This commit is contained in:
@@ -47,13 +47,16 @@ gzip test.txt
|
||||
```
|
||||
This generates the file `test.txt.gz`. Now, you can copy the file over to your project and allow pymakr to upload the `.gz` file (Pymakr Settings --> Global settings --> Upload file types, add `.gz` in the list). On your device, you can run the following to decompress the file:
|
||||
```python
|
||||
import zlib
|
||||
import os
|
||||
|
||||
#verify the presence of the file
|
||||
file = 'test.txt.gz'
|
||||
print('dir', os.listdir())
|
||||
print(file, os.stat(file))
|
||||
|
||||
with open('test.txt.gz', 'r') as file:
|
||||
data = uzlib.DecompIO(file, 31)
|
||||
data = zlib.DecompIO(file, 31)
|
||||
#use data.readline() to read a single line
|
||||
print(data.read())
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user