Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 pyUnrar2 批量提取 rar 文件,我想获取的是文件提取后所在目录的名称?
提取路径设置为 的参数extract()。
extract()
如果存档有自己的父目录,您可以使用以下命令获取它infolist():
infolist()
import UnRAR2 rarc = UnRAR2.RarFile('test.rar') list = rarc.infolist() if list[0].isdir: print 'Parent directory in archive: %r' % list[0].filename