相关文章推荐
逆袭的板栗  ·  MySQL 查询 JSON ...·  5 月前    · 
体贴的小马驹  ·  hp, ht, pid, tid = ...·  5 月前    · 
失望的乌冬面  ·  QTextEdit / ...·  8 月前    · 

用Python读取二进制文件并转换为ASCII码

0 人关注

我正在开发专利软件,作为工作中的一个副业,所以我不能分享源文件。不过,我可以分享我目前的起始代码和它的输出。

My code:

import os, sys
currentdir = os.path.dirname(os.path.realpath(__file__))
parentdir = os.path.dirname(currentdir)
sys.path.append(parentdir)
testfile = os.path.join(currentdir, 'vlctge55.mb1')
testhand = open(testfile, 'rb')
with open(os.path.join(currentdir, 'test01output.txt'),'w') as fhand:
    lines = testhand.readlines()
    for line in lines: