mow*_*ker 0 python string binary
我正在尝试学习Python,目前正在网上做一些练习.其中一个涉及读取zip文件.
当我做:
import zipfile
zp=zipfile.ZipFile('MyZip.zip')
print(zp.read('MyText.txt'))
Run Code Online (Sandbox Code Playgroud)
它打印:
b'Hello World'
Run Code Online (Sandbox Code Playgroud)
我只想要一个带有"Hello World"的字符串.我知道这很愚蠢,但我能想到的唯一方法就是:
import re
re.match("b'(.*)'",zp.read('MyText.txt'))
Run Code Online (Sandbox Code Playgroud)
我该怎么办呢?