library.py 文件源码

python
阅读 37 收藏 0 点赞 0 评论 0

项目:slider 作者: llllllllll 项目源码 文件源码
def _osu_files(path, recurse):
        """An iterator of ``.osu`` filepaths in a directory.

        Parameters
        ----------
        path : path-like
            The directory to search in.
        recurse : bool
            Recursively search ``path``?

        Yields
        ------
        path : str
            The path to a ``.osu`` file.
        """
        if recurse:
            for directory, _, filenames in os.walk(path):
                for filename in filenames:
                    if filename.endswith('.osu'):
                        yield pathlib.Path(os.path.join(directory, filename))
        else:
            for entry in os.scandir(directory):
                path = entry.path
                if path.endswith('.osu'):
                    yield pathlib.Path(path)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号