小编Mus*_*usa的帖子

Python中的二进制到ASCII

我正在尝试解码位于.txt文件中的二进制文件,但我卡住了.我没有看到任何可能出现的可能性.

def code(): testestest
  ascii = {'01000001':'A', ...}
  binary = {'A':'01000001', ...}
  print (ascii, binary)

  def encode():
    pass

  def decode(code,n):
    f = open(code, mode='rb') # Open a file with filename <code>
    while True:
      chunk = f.read(n)           # Read n characters at time from an open file
      if chunk == '':             # This is one way to check for the End Of File in Python 
        break
      if chunk != '\n':
        # Process it????
        pass
Run Code Online (Sandbox Code Playgroud)

如何获取.txt文件中的二进制文件并将其输出为ASCII?

python binary ascii

1
推荐指数
1
解决办法
4223
查看次数

标签 统计

ascii ×1

binary ×1

python ×1