python解压tar.gz ftp,解压缩tar.Z文件与python?

该博客讨论了如何在Python中处理.tar.Z文件,这种文件格式是Unix系统中压缩的结果。由于Python标准库不直接支持.tar.Z,作者提到了可能的解决办法,包括使用第三方库如gzip,或者通过调用系统命令如gzip或InstallShield来解压。还提到了可能的.LZW压缩文件,并推荐了一个可能有帮助的库。
摘要由CSDN通过智能技术生成

I need to write a python script that retrieves tar.Z files from an FTP server, and uncompress them on a windows machine. tar.Z, if I understood correctly is the result of a compress command in Unix.

Python doesn't seem to know how to handle these, it's not gz, nor bz2 or zip. Does anyone know a library that would handle these ?

Thanks in advance

解决方案

If GZIP -- the application -- can handle it, you have two choices.

Try the Python gzip library. It may work.

Use subprocess Popen to run gzip for you.

It may be an InstallShield .Z file. You may want to use InstallShield to unpack it and extract the .TAR file. Again, you may be able to use subprocess Popen to process the file.

It may also be a "LZW compressed file". Look at this library, it may help.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值