更新时间:2023-02-10 18:24:23
我找到答案了用另一种编码,并写入字节这个问题:
I found answer for this question in using another encoding, and writing bytes:
file = open('file.bin','wb')
cur = 0
while cur < len(code):
c = int(code[cur:cur+8], 2)
file.write(bytes(chr(c), 'iso8859-1'))
cur += 8
我写的字符串以0和1:
000101101100000000010010110000010011000000010010001000100000000000010111110000110100001100010001
I wrote string with 0 and 1: 000101101100000000010010110000010011000000010010001000100000000000010111110000110100001100010001
如果我打开文件,记事本,我会看到АБ0ГC
有些符号没有显示...但如果我要在十六进制编辑者打开文件,我将看到:
And if i open file with notepad I will see АБ0" ГC
some symbols not shown... but if i will open file in hex redactor I will see:
00010110 11000000 00010010 11000001 00110000 00010010 00100010 00000000 00010111 11000011 01000011 00010001
***的96位!