2024-05-23 19:11:45 发布
网友
我用哈夫曼算法为我的在线课程项目创建了一个压缩器。问题是二进制输出文件(10101010011..)比原始文件大。你知道吗
10101010011..
上这门课的老师不知道答案。你知道吗
我使用这个,其中ciph_text是0和1的字符串
ciph_text
with open(full_name,'w') as temp: temp.write(ciph_text)
你知道吗? 我可以张贴更多的代码,如果要求。你知道吗
int(x,2)是你的朋友:
>>> a="00001010000101000001111000101000" >>> for b in range(0, len(a), 8): ... print a[b:b+8], int(a[b:b+8], 2) ... 00001010 10 00010100 20 00011110 30 00101000 40
int(x,2)是你的朋友:
相关问题 更多 >
编程相关推荐