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...
+1
A:
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.
Mark Byers
2010-03-30 22:21:52
+1
A:
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!
jathanism
2010-03-31 00:21:45
Don't use `mimetypes`. Use `magic` instead, although it's not part of the stdlib.
Ignacio Vazquez-Abrams
2010-03-31 00:33:38
I looked at using magic, but was hoping there was something already out there...May have to write it!
Lokkju
2010-03-31 02:12:29
What's wrong with `mimetypes`?
jathanism
2010-03-31 03:46:28