Need help compressing .txt files in python 3.4.3 and not losing data whilst compressing them : I'm trying to compress my .txt file which are being made within another code but every time i compress them they go into a winrar file and lose all there data within them so all the text goes. This is the code i'm using: 

import gzip
with gzip.open('dictionary.txt.gz', 'wb') as f:
    f.write
   
I don't see anything wrong with it as it is actually working but like i said the winrar file (compressed file) loses all it's data and I'm very confused as to why. This isn't even the hard bit to what i have to do :(