1

In my Python program i heavily use os and shutil modules for file/directory operations. I wrote many utility functions to generalize patterns, like removing all files inside a folder, temporarily change working directory, split path into fragments, recursive glob, remove all files matching regex, etc.

Is there any library for Python which has a multitude of such high-level file/directory utility functions, possibly built on top of os and shutil modules, so i can write less boilerplate?

4

1 回答 1

0

我不确定您为什么要避免使用 os 或 shutil,因为我认为它们是为这种特殊用途而设计的。我认为大多数其他库可能会建立在 os 和 shutil 之上(就像你所做的那样)。

但是,您可能希望使用其他一些 python 的内置文件处理库来补充这些,如 sushglobfnmatch.

此链接收集所有内置的文件操作库http://www.itmaybeahack.com/book/python-2.6/html/p04/p04c06_file1.html

于 2013-07-01T09:37:19.143 回答