7

使用python将包含二进制内容的字符串转换成二进制bit写入文件

 3 years ago
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.
neoserver,ios ssh client
使用python将包含二进制内容的字符串转换成二进制bit写入文件 - 暗无天日

使用python将包含二进制内容的字符串转换成二进制bit写入文件

使用第三方包 bitarray,就很简单了

import bitarray as ba
bits=ba.bitarray('0000111111')
with open('xxx.bin','wb') as f:
    bits.tofile(f)
2019-09-09 2019-09-09 编程之旅 lujun9972

Related Issues not found

Please contact @lujun9972 to initialize the comment

Generated by Emacs 27.x(Org mode 9.x)

Copyright © 2014 - 2021 lujun9972   -   Powered by EGO
Themed with emacs_love


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK