import redef test(teststr, *args): #strformatter = "%s" myargs = args[0] if len(args) > 1: for i in args[1:]: myargs += ‘|‘ + str(i) #strformatter += "|%s" #regex = "\"" + strformatter + "\"" + " % " + "(" + myargs + ")" regex = "myargs" print(regex) #print(re.findall(regex, teststr)) print(re.findall(regex, s)) s = "chinese,translated,censored,nanao,sole_male,beauty_mark,blowjob,kimono,milf,sole_female,td_full_color"#t1 = re.compile(‘milf‘, re.S)regex = "%s|%s|%s" % (‘chinese‘, ‘milf‘, ‘sdfjsdfsdf‘)print(regex)print(len(re.findall(regex, s)))#test(s, "chinese", "milf")
import re def test(teststr, *args): length = len(args) regex = args[0] if len(args) > 1: for i in args[1:]: regex += ‘|‘ + str(i) print(regex) print(re.findall(regex, teststr)) if len(re.findall(regex, teststr)) == length: print("ok") s = "chinese,translated,censored,nanao,sole_male,beauty_mark,blowjob,kimono,milf,sole_female,td_full_color"test(s, "chinese", "milf", "nanao")
import re def test(teststr, *args): length = len(args) regex = args[0] if len(args) > 1: for i in args[1:]: regex += ‘|‘ + str(i) print(regex) print(re.findall(regex, teststr)) re2 = re.findall(regex, teststr) print(re2) re2 = sorted(set(re2), key=re2.index) print(re2) if len(re2) == length: list2.append(num) s = "english,dragon_ball_z,cell,bisexual,blowjob,insect_boy,selfcest,anal,beauty_mark,blood,blowjob,cunnilingus,dark_skin,double_blowjob,double_penetration,piercing,sole_female,td_full_color,td_group,td_mmf_threesome"test2 = "chinese,milf,blowjob"test5 = test2.split(",")print(test5)test(s, *test5)#test(s, "chinese", "milf", "nanao")
原文地址:https://www.cnblogs.com/cerutodog/p/9938094.html
时间: 2024-10-16 13:47:22