0
的Python解壓tar文件中提取需要的地方後不解壓所有目錄內容目錄的Python的焦油提取不提取該目錄中的內容
我有這樣
'py'
'py/pran'
'py/typ'
'py/typ/tui'
'py/typ/tui/utopia'
'py/typ/tui/utopia/nuthsell'
'py/typ/tui/utopia/revy'
'py/typ/tui/utopia/bapy'
import tarfile
tar = tarfile.open('py.tar.gz','r:gz')
memberList = []
for member in tar.getmembers():
if member.name.endswith('utopia'):
memberList.append(member)
tar.extractall(path='.',members=memberList)
的目錄結構我只能看到烏托邦文件夾,但沒有找到烏托邦內的子文件夾和內容
我前一陣子想通了這一點,但感謝的快速答覆 –