python - Compressing strings and appending to file on the fly -


i have following csv writer class:

class csvwriter():     writer = none     writehandler = none     @classmethod     def open(cls,file):         cls.writehandler = open(file,'wb')         cls.writer = csv.writer(cls.writehandler, delimiter=',',quotechar='"', quoting=csv.quote_nonnumeric)      @classmethod     def write(cls,arr):         cls.writer.writerow(arr)      @classmethod     def close(cls):         cls.writehandler.close() 

which can generate proper csv files without ever having store full array in memory @ single time.

however, files created through use of code can quite large, i'm looking compress them, rather writing them uncompressed. (in order save on disk usage). can't store file in memory either, i'm expecting files of on 20gb regular occurence.

the recipients of resulting files not sysadmins of pcs, nor use linux, i'm constrained in types of algorithms i'm able use task. preferably, solution use compression scheme that's natively readable (no executables required) in windows, osx , linux distribution.

i've found gzip provides handy interface in python, reading gzipped files in windows seems quite hassle.. ideally i'd put them in zip archive, zip archive don't allow append data files present in archive, forces me store whole file in memory, or write data away several smaller files able fit in memory.

my question: there solution benefit best of both worlds? widespread availability of tools read target format on end-user's machine, , ability append, rather write whole file in 1 go?

thanks in advance consideration!

gzlog may provide functionality you're looking for. efficiently appends short strings gzip file, intended applications short messages appended long log.


Comments

Popular posts from this blog

jquery - How do you format the date used in the popover widget title of FullCalendar? -

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -