我试图读取python中的压缩文件(.gz),但遇到了问题。你知道吗
import gzip
import gensim
import logging
import os
logging.basicConfig(
format='%(asctime)s : %(levelname)s : %(message)s',
level=logging.INFO)
data_file = r"C:\\PythonProgs\\OpinRank.gz"
def show_file_contents(input_file):
with gzip.open(input_file, 'rb') as f:
for i, line in enumerate(f):
print(line)
break
show_file_contents(data_file)
我本想读zip文件,但实际上给了我这个错误:
FileNotFoundError:[Errno 2]没有这样的文件或目录:“C:\PythonProgs\OpinRank.gz公司'
目前没有回答
相关问题 更多 >
编程相关推荐