Ask coding questions

← Back to all posts
SaraGrella (8)

how can i zip a file and download it in a .py version?

JustARatherRidi (215)
  • First, make sure the repl you want to download is yours. If it isn't, change one character somewhere so that the repl is forked to your account.

  • Then click on these 3 dots at the top left of your screen:

  • In the drop down menu, Select 'Download as zip'

From there, once you've downloaded it, you can use a compressing tool like WinZip or WinRAR, or even an online extractor like this one to extract the files. And you're done!

Hope this helped, let me know if I lost you anywhere.

a5rocks (829)


import zlib

with open('file.txt', 'rb') as f:
  a = zlib.compress(, level=9)

with open('', 'wb') as f


If you want to make specific files a zip file. Please keep in mind I'm only putting this here so it's a more complete answer.

JustARatherRidi (215)

@a5rocks As I understood it, I thought op was trying to download a repl as a zip file and extract a python file from it. But if the op was trying to use a python script to extract a file, then this is probably the way to do it. +1

a5rocks (829)

@JustARatherRidi yeah i though op was trying to download too, but didn't want to leave a possibility out. (plus i had extra time xd)


I’d answer but, I honestly don’t know.