import zipfile
# First, create the zip:
# echo 'Hello, World' > hello.txt
# zip hello.zip hello.txt
with zipfile.ZipFile('hello.zip') as myzip:
with myzip.open('hello.txt') as myfile:
print(myfile.read(5))
print(myfile.seek(2, 1))
print(myfile.read1(-1))
❯ python3.11 reproduce.py
b'Hello'
7
b'World\n'
❯ python3.12 reproduce.py
b'Hello'
7
b''