Created
February 26, 2019 12:53
-
-
Save winni2k/6e63b2a60c8c22779eeb6f8038f56a86 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from zipfile import ZipFile | |
text = b'hello world' | |
with ZipFile('spam.zip', 'w') as inzip: | |
with inzip.open('eggs.txt', 'w') as infile: | |
infile.write(text) | |
with ZipFile('spam.zip', 'r') as myzip: | |
with myzip.open('eggs.txt', 'r') as myfile: | |
print(myfile.read()) | |
myfile.seek(0) | |
print(myfile.read()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment