We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
当我运行程序时候,总是出错。 with gzip.open(data_path, 'rb') as f: data = json.loads(f.read()) return data 问题出现在这里,json接收str类型,gzip读取后是其他类型,尝试过类型转换,但是也没有成功,有没有解决办法。
The text was updated successfully, but these errors were encountered:
自己解决了,查询gzip使用方法,https://docs.python.org/3/library/gzip.html, 如果想要返回为str类型,需要将with gzip.open(data_path, 'rb') as f中的'rb'改变成‘rt’。
Sorry, something went wrong.
请问下,问改写了'rt'然后JSON文件出现如下错误,请问你有没有遇到类似错误呢? raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
No branches or pull requests
当我运行程序时候,总是出错。
with gzip.open(data_path, 'rb') as f:
data = json.loads(f.read())
return data
问题出现在这里,json接收str类型,gzip读取后是其他类型,尝试过类型转换,但是也没有成功,有没有解决办法。
The text was updated successfully, but these errors were encountered: