用不到就根本记不住之正则

re 模糊匹配

USER_REGULATION = [
    {"method": ["GET", "PUT", "POST"], "pattern": "store/.*/pictures"},
    {"method": ["GET", "PUT", "POST"], "pattern": "users/.*"},
]

 

list = []

def text():

    for item in USER_REGULATION:
        regex = re.compile(item["pattern"])
        match = regex.search(path_url)
        if match:

    list.append(item)

 

posted @ 2019-10-28 16:27  路口有雾  阅读(136)  评论(0编辑  收藏  举报