默认情况下,会遍历目录下所有文件,写入数组返回.

    - ``prefix`` 会过滤以 其开头的所有文件
    - ``suffix`` 结尾

    :param pth:
    :type pth:
    :param prefix:
    :type prefix:
    :param suffix:
    :type suffix:
    :return:
    :rtype:

def walk_dir_with_filter(pth, prefix=None, suffix=None):
    """
        默认情况下,会遍历目录下所有文件,写入数组返回.

    - ``prefix`` 会过滤以 其开头的所有文件
    - ``suffix`` 结尾

    :param pth:
    :type pth:
    :param prefix:
    :type prefix:
    :param suffix:
    :type suffix:
    :return:
    :rtype:
    """
    if suffix is None or type(suffix) != list:
        suffix = []
    if prefix is None or type(prefix) != list:
        prefix = []

    r = []
    for root_, dirs, files in os.walk(pth):
        for file_ in files:
            full_pth = os.path.join(root_, file_)

            # 排除 \.开头文件, 及 .pyc .md 结尾文件
            c = False
            for x in prefix:
                if file_.startswith(x):
                    c = True
                    break
            if c:
                continue
            # if runs here , c is False
            for x in suffix:
                if file_.endswith(x):
                    c = True
                    break
            if c:
                continue

            r.append(full_pth)
    return r