有没有类似于 Perl 的 Archive::Extract 的 Python 包?

发布于 2024-08-27 03:59:21 字数 97 浏览 6 评论 0原文

我正在寻找一个能够自动检测存档类型并提取存档(zip、tar.gz 等)的包。在 Perl 中,这很容易 - 在 Python 中,我找不到任何简单的包/类来做到这一点......

I'm looking for a package that will automatically detect the type of and extract an archive (zip, tar.gz, etc). In Perl, this is easy - in Python, I can't find any simple package/class to do it...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

2024-09-03 03:59:21

摆脱马克·拜尔斯的回应,也许您可​​以将所有这些与mimetypes(也来自标准库)结合在一起。您可以识别文件的类型,并相应地处理它。世界需要 Python 版本的 Archive::Extract,我们希望您能够编写它!

Riding off of Mark Byers' response, perhaps you can tie all of these together with mimetypes (also from the standard library). You could identify the type of file, and process it accordingly. The world needs a Python version of Archive::Extract, and we want you to write it!

你的背包 2024-09-03 03:59:21

在 Python 中,您可以使用:

我不知道有任何包装器可以自动选择正确的格式。如果它存在,似乎在上述任何模块的文档中都没有提及。

In Python you can use:

I'm not aware of any wrapper that can choose the right format automatically. If it exists it doesn't seem to be mentioned in the documentation for any of the above modules.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文