解压缩tar.Z文件与python? [英] uncompressing tar.Z file with python?

查看:965
本文介绍了解压缩tar.Z文件与python?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要编写一个python脚本,从FTP服务器检索tar.Z文件,并在Windows机器上解压缩它们。 tar.Z,如果我理解正确是在UNIX中的 compress 命令的结果。

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似乎不知道如何处理这些,它不gz,也不bz2或zip。

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 ?

提前感谢

推荐答案

如果GZIP - 应用程序可以处理它,您有两个选择。

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


  1. c $ c> gzip 库。

使用子流程Popen 运行 gzip

它可能是一个InstallShield .Z文件。您可能需要使用InstallShield解压缩并解压缩.TAR文件。再次,您可以使用子进程Popen 来处理文件。

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.

它也可以是LZW压缩文件。看看这个库,可能会有帮助。

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

http://www.chilkatsoft.com/compression-python.asp

这篇关于解压缩tar.Z文件与python?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆