2025-03-26 03:09:08
这所谓的特殊模式很难用正则表达式搜索出来。不过可以先用正则搜索出四个字的词语,然后再进行判断
xxyy模式:r[0]==r[1] and r[2]==r[3]
sums = ['一', '二', '三', '四']
数字模式:[True if i in sums else False for i in r] # 判断词语是否有数字
animal = ['猫', '狗', '鸡', '鸭']
动物模式: [True if i in animal else False for i in r] # 判断词语是否有动物