![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Python
春上小站
这个作者很懒,什么都没留下…
展开
-
模式匹配列表 闭包
import re def build_match_and_apply_functions(pattern, search,replace): def matches_rule(word): return re.search(pattern, word) def apply_rule(word): return re.sub(search, rep...原创 2018-05-02 21:37:43 · 130 阅读 · 0 评论 -
字母组合算数猜谜
import re import itertools def solve(puzzle): words = re.findall('[A-Z]+', puzzle.upper()) unique_characters = set(''.join(words)) assert len(unique_characters) <= 10, 'Too many letters...翻译 2018-05-05 01:27:39 · 259 阅读 · 0 评论