2
Python 3.4の "シンボリックリンクに従う"機能でtar + gzip圧縮を使うにはどうすればいいですか?問題は次のとおりです。 ":GZ W" モードが、( "間接参照" オプションに Python tarfile:tar + gzip圧縮をシンボリックリンクに従う方法?
- tarfile.openは()をサポートしていGZ 「モード
コード:
...
mode = ""
if bckentry['method'] == "tar":
mode = "w"
elif bckentry['method'] == "targz":
mode = "w:gz"
archive = tarfile.TarFile(name=filepath, mode=mode)
archive.dereference = True if bckentry['followsym'] == "yes" else False
# archive = tarfile.open(filepath, mode=mode)
if bckentry['withpath'] == 'yes':
for entry in bckentry['include_dirs']:
archive.add(entry, filter=self.filter_tar)
elif bckentry['withpath'] == 'no':
for entry in bckentry['include_dirs']:
archive.add(entry, arcname=os.path.basename(entry), filter=self.filter_tar)
...
を:あなただけのキーワード引数として渡す場合
したがって、あなたは、それらのいずれかと
dereference
を使用することができます!ありがとう、私はドキュメントを読んで、この明白な方法を試してみませんでした。 – Balint