Programming

(Python) Data Compression

steloflute 2012. 8. 10. 00:46

http://docs.python.org/tutorial/stdlib.html#data-compression


>>> import zlib
>>> s = 'witch which has which witches wrist watch'
>>> len(s)
41
>>> t = zlib.compress(s)
>>> len(t)
37
>>> zlib.decompress(t)
'witch which has which witches wrist watch'
>>> zlib.crc32(s)
226805979

 

 

'Programming' 카테고리의 다른 글

Python으로 KOSPI200 시세 얻기  (0) 2012.08.10
sleep command in python  (0) 2012.08.10
3 ways to define a JavaScript class  (0) 2012.08.05
The Need For One True Coding Style  (0) 2012.08.02
(Javascript) Random Text  (0) 2012.07.30