阅读背景:

在Python中将位转换为字节

来源:互联网 

I am trying to convert a bit string into a byte string, in Python 3.x. In each byte, bits are filled from high order to low order. The last byte is filled with zeros if necessary. The bit string is initially stored as a "collection" of booleans or integers (0 or 1), and I want to return a "collection" of integers in the range 0-255. By collection, I mean a list or a similar object, but not a character string: for example, the function below returns a generator.I am trying to convert a bit string into a byte




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: