7
使用python将包含二进制内容的字符串转换成二进制bit写入文件
source link: https://www.lujun9972.win/blog/2019/09/09/%E4%BD%BF%E7%94%A8python%E5%B0%86%E5%8C%85%E5%90%AB%E4%BA%8C%E8%BF%9B%E5%88%B6%E5%86%85%E5%AE%B9%E7%9A%84%E5%AD%97%E7%AC%A6%E4%B8%B2%E8%BD%AC%E6%8D%A2%E6%88%90%E4%BA%8C%E8%BF%9B%E5%88%B6bit%E5%86%99%E5%85%A5%E6%96%87%E4%BB%B6/index.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
使用python将包含二进制内容的字符串转换成二进制bit写入文件 - 暗无天日
使用python将包含二进制内容的字符串转换成二进制bit写入文件
使用第三方包 bitarray
,就很简单了
import bitarray as ba bits=ba.bitarray('0000111111') with open('xxx.bin','wb') as f: bits.tofile(f)
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK