WhiteNameList_URL = 'E:\WhiteNameList.txt'
whitenamelist= open(WhiteNameList_URL, 'r')
WhiteNameList = whitenamelist.readlines();
all_txt = "\n".join(allWebsiteURLs['e'])
print 'print allWebsiteURLs txt'
print all_txt
for white in WhiteNameList:
print white
pattern = re.compile(r"".join(white))
print "".join(white)
match = pattern.search(all_txt)
print match
if match:
print 'find it'
else:
print 'not find'
该段代码目的是从白名单中找出在字典allWebsiteURLs['e']中匹配的URL,但是结果却找不出来,希望大神能帮忙解决这个问题!!!
不知道LZ的数据是怎么样的,如果allWebsiteURLs和WhiteNameList的里面找出匹配的url,可以用set(allWebsiteURLs).intersection(set(WhiteNameList))就可以了么