maxheader.py 文件源码

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

项目:blemd 作者: niacdoial 项目源码 文件源码
def getFiles(wc_name):
    # assume wild card is in the last part
    path, file = os.path.split(wc_name)
    returnable = []
    if '*' in path:
        raise ValueError('must implement getFiles better')
    try:
        a, dirs, files = next(os.walk(os.path.normpath(path)))
    except StopIteration:
        return returnable
    for com in files:
        rematcher = wc_name.replace('/', '\\').replace('\\', '\\\\').\
                            replace('.', '\\.').\
                            replace('*', '.*').\
                            replace('(', '\\(').\
                            replace(')', '\\)')
        if re.fullmatch(rematcher, path.replace('/', '\\')+ '\\' + com):
            returnable.append(os.path.join(path, com))
    return returnable
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号