An elementary Python data compression question
Hi all,
Though I don't work in data compression, but for learning
purpose only I ran a program very similar to the one given in version
specific tutorial from www.python.org. (ch 11, tut.pdf). The two programs are:
PROGRAM 1
import zlib
s = "witch which has which witches wrist watch"
print "Original String is ::%s:: and length of the string is ::%d::" %(s,len(s))
t = zlib.compress(s)
print "Compressed String is ::%s:: and length of the string is ::%d::" %(t,len(t))
print "Decompressed String is ::%s:: and length of the decompressed string is ::%d::" %(zlib.decompress(t),len(zlib.decompress(t)))
PROGRAM 2
import zlib
s = "witch which has which witches wrist watch"
print "Original String is ::%s:: and length of the string is ::%d::" %(s,len(s))
t = zlib.compress(s)
print "Compressed String is ::%s:: and length of the string is ::%d::" %(t,len(t))
print "Decompressed String is ::%s:: and length of the decompressed string is ::%d::" %(zlib.decompress(t),len(zlib.decompress(t)))
Now the problem is that:
in program2, the 'len(t)', i.e. length of
the compressed string is greater than length of the original string!!!
In program 1, this 'apparent anomaly' doesn't occur, and this is the
string used in the python.org tutorial.
Can anybody provide an
explanation? At this point, I don't want to read a few hundred pages on
data compression to find out the answer.
Thanks in advance,
Abhishek Pathak.
heb7e sh8at be th34nkie 4it on da posting left & righ8ty
Posted by flight center — 24 Aug 2010, 03:18
We7ll I8be dat9 ogr6e speekie da speekie, gratz & than4x
Posted by cruises — 24 Aug 2010, 03:17
Th4t be an epic da shizzi4 post, th4nkie 4it & in da futures we'll be seeing more of it
Posted by travel — 24 Aug 2010, 03:15
how can i tell her what i can't say
Posted by online bingo — 16 Aug 2010, 21:51
Oh yea, almost forgot, I'm bookmarking your blog. Thanks again!
Posted by online bingo — 16 Aug 2010, 21:50
After much thinking I think your title "ai an elementary python data compression question..." discribes your content
getting over dumped
get over my ex girlfriend
.
Posted by how to get over ex — 12 Aug 2010, 17:10
I can say that your headline "ai an elementary python data compression question..." is just awsome, other blogger should get the education from you.
how to get over a sudden break up
how do you get over your ex
.
Posted by ways to get over your ex — 09 Aug 2010, 23:32
Your headline "ai an elementary python data compression question..." discribes your content.
Posted by get over your ex boyfriend — 09 Aug 2010, 05:17
i like this site.. have a lot of information.... these type of sites always magnetize me to post comment...
Posted by bridaldesign — 17 Jul 2010, 17:28
This ergonomic high back office chair extends the full length of the back, up to the shoulders and includes support for the head and neck. Our chairs are crafted to perfection and designed to the bodies natural shape, you will find complete comfort with its PU leather material and padded arm rests.
The chair is fitted with optimised functions which include gas height adjustment and tilt mechanism, to allow for greater comfort and allowing you to find your ideal position.
Our executive range of office chairs are built to be Safe, to last for years and cannot be beat in any head to head comparison in its class. Easy assemble, a strong nylon base and 360° swivel, top this PU leather, a fantastic executive look.
Posted by officechairs — 08 Jul 2010, 09:57
Thanks !
Auto spiele
Mädchen spiele
Posted by Manu — 28 May 2010, 02:11
I recently came across your article and have been reading along. I want to express my admiration of your writing skill and ability to make readers read from the beginning to the end. I would like to read newer posts and to share my thoughts with you.
Posted by telecharger sonnerie gratuite — 22 May 2010, 06:49
I found Pound to be more stable than Python actually for my website.
Posted by wrist weights — 22 May 2010, 06:07
侦探公司专业提供绍兴婚姻调查服务,提供与网络营销主题相关的信息资讯钻石。!
…杭州特价机票……
侦探公司专业提供绍兴婚姻调查服务,提供与网络营销主题相关的信息资讯。杭州网站建设、杭州网页设计、
。侦探公司专业提供绍兴婚姻调查服务,提供与网络营销主题相关的信息资讯上海侦探!
,
实验室家具
侦探公司专业提供绍兴婚姻调查服务,提供与网络营销主题相关的信息资讯
,。网站推广、网站排名、
…、杭州搬家公司,
!侦探公司专业提供绍兴婚姻调查服务,提供与网络营销主题相关的信息资讯google排名
。
Posted by nv — 17 May 2010, 12:25
Im always looking for new and more efficient ways to compress files.
Posted by wrist weights — 10 Apr 2010, 20:15
aqian100406
Designer Watches
Designer Mens Watches and Womens Watches
Wrist Watches Online Shop
Replica Sunglasses
Cheap Sunglasses
Wholesale Replica Sunglasses
Cheap Replica Sunglasses
Replica Scarf
Replica Gucci Sunglasses
wholesale Dior Sunglasses
wholesale Bvlgari Sunglasses
Replica Louis Vuitton Sunglasses
Marc Jacobs replica Sunglasses
wholesale Chloe glasses
wholesale Fendi Sunglasses
wholesale Prada Sunglasses
Cheap Sunglesses Givenchy
wholesale Ferragamo Sunglasses
Cheap Armani Sunglasses
Replica Chopard Sunglasses
wholesale Police glasses
replica Coach Sunglasses
Alexander McQueen Scarves
Posted by Replicawatches — 06 Apr 2010, 14:27
I am an AI enthusiast, a Python Programmer - me too and I am a girl by the way, it always brings up more smiley faces :)
Jessica Jameson
Posted by Internet Hosting — 22 Mar 2010, 22:57
So nobody can help us...? damn have to get my hands dirty with some research then - and I dont mind doing python research at all
JohnV
Posted by Electronic Cigarette — 19 Mar 2010, 01:41
I had a same problem/question some time ago but it wasnt so important that time and I forgot about it, but it wouldnt hurt if anybody could come up with something...
David Sims
Posted by Fuel — 10 Feb 2010, 16:29
thanks for posting this, useful and much appreciated. rather new in this stuff, I pay much attention to self-education, so appreciate any useful info on the topic
Posted by Torrents Search — 27 Oct 2009, 17:38