相关疑难解决方法(0)

如何在zip中打开unicode文本文件?

我试过了

with zipfile.ZipFile("5.csv.zip", "r") as zfile:
    for name in zfile.namelist():
        with zfile.open(name, 'rU') as readFile:
                line = readFile.readline()
                print(line)
                split = line.split('\t')
Run Code Online (Sandbox Code Playgroud)

它回答:

b'$0.0\t1822\t1\t1\t1\n'
Traceback (most recent call last)
File "zip.py", line 6
    split = line.split('\t')
TypeError: Type str doesn't support the buffer API
Run Code Online (Sandbox Code Playgroud)

如何打开文本文件作为unicode而不是b

python unicode file-io zip python-3.x

6
推荐指数
2
解决办法
7021
查看次数

标签 统计

file-io ×1

python ×1

python-3.x ×1

unicode ×1

zip ×1