Is it somehow possible to extract .c开发者_JAVA百科ab files in python?
Not strictly answering what you asked, but if you are running on a windows platform you could spawn a process to do it for you.
Taken from Wikipedia:
Microsoft Windows provides two command-line tools for creation and extraction of CAB files. They are MAKECAB.EXE (included within Windows packages such as 'ie501sp2.exe' and 'orktools.msi'; also available from the SDK, see below) and EXTRACT.EXE (included on the installation CD), respectively. Windows XP also provides the EXPAND.EXE command.
I had the same problem last week so I implemented this in python. Comments, additions and especially pull requests welcome: https://github.com/hughsie/python-cabarchive
Oddly, the msilib can only create or append to .CAB files, but not extract them. :(
However, the hachoir parser module can apparently read & edit Cabinets. (I have not used it, though, so I couldn't tell you how fitting it is or not!)
精彩评论