2024-05-13 04:12:58 发布
网友
我知道有一个模块叫pylzma。但它只支持lzma,不支持lzma2。在
我当前的解决方案是使用subprocess.call()调用7z程序。在
subprocess.call()
有更好的方法吗?在
您可以使用backports.lzma,有关详细信息,请参阅:Python 2.7: Compressing data with the XZ format using the "lzma" module
那么这只是一个简单的问题,例如:
from backports import lzma with open('hello.xz', 'wb') as f: f.write(lzma.compress(b'hello', format=lzma.FORMAT_XZ))
或更简单(默认为XZ格式):
有关用法的详细信息,请参见http://docs.python.org/dev/library/lzma.html。在
您可以使用backports.lzma,有关详细信息,请参阅:Python 2.7: Compressing data with the XZ format using the "lzma" module
那么这只是一个简单的问题,例如:
或更简单(默认为XZ格式):
^{pr2}$有关用法的详细信息,请参见http://docs.python.org/dev/library/lzma.html。在
相关问题 更多 >
编程相关推荐