这是Python文档的摘录:
If exclude is given it must be a function that takes one filename argument and returns a boolean value. Depending on this value the respective file is either excluded (True) or added (False).
我必须承认我不知道那是什么意思。
此外:
Deprecated since version 2.7: The exclude parameter is deprecated, please use the filter parameter instead. For maximum portability, filter should be used as a keyword argument rather than as a positional argument so that code won’t be affected when exclude is ultimately removed.
好的。。。以及“过滤器”的定义:
If filter is specified it must be a function that takes a TarInfo object argument and returns the changed TarInfo object. If it instead returns None the TarInfo object will be excluded from the archive.
。。。回到原点:)
我真正需要的是一种将排除的数组(或“:”分隔字符串)传递给tarfile.add的方法。
我不介意你试着解释一下那些来自PyDocs-ment的段落。
备注:
我突然想到:
但是,我想用一种更文明的方式来做
目前没有回答
相关问题 更多 >
编程相关推荐