我一直在学习python得到了基础知识
为了更好,我一直在尝试创建一个程序来打开存档文件,而不是创建只是打开。
我可以轻松创建和打开7z文件但是当使用7zip创建存档时它不会打开它,任何人都知道为什么以及如何打开7zip创建的文件
data = b"Insert Data Here"
with lzma.open("file.7z", "w") as f:
f.write(data)
with lzma.LZMAFile("file.7z") as f:
fc =f.read()
print(fc)
追溯
Traceback (most recent call last):
File "<string>", line 420, in run_nodebug
File "C:\Users\<name>\Documents\Py\decompression.py", line 20, in <module>
main()
File "C:\Users\<name>\Documents\Py\decompression.py", line 15, in main
fc =f.read()
File "C:\Python33\lib\lzma.py", line 291, in read
return self._read_all()
File "C:\Python33\lib\lzma.py", line 244, in _read_all
while self._fill_buffer():
File "C:\Python33\lib\lzma.py", line 238, in _fill_buffer
self._buffer = self._decompressor.decompress(rawblock)
_lzma.LZMAError: Input format not supported by decoder