Skip to content

Instantly share code, notes, and snippets.

@aashishrbhandari
Last active November 3, 2022 11:41
Show Gist options
  • Save aashishrbhandari/9f8c1e7dc1823ed028622bad81e8f089 to your computer and use it in GitHub Desktop.
Save aashishrbhandari/9f8c1e7dc1823ed028622bad81e8f089 to your computer and use it in GitHub Desktop.
# Best Practise
# Reference: https://stackoverflow.com/questions/11482342/read-a-large-zipped-text-file-line-by-line-in-python/11482347
# If Reading a Zipped/Compressed File
import zipfile
with zipfile.ZipFile(zip_file) as z:
with z.open(zip_file) as f:
for line in f:
print(line)
# If Reading a File Effectively & Effecienctly
with open(normal_file) as f:
for line in f:
print(line)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment