我有一个包含成千上万个网站的数据库,我想要搜索所有网站中的特定字符串。你认为最快的方法是什么?我想首先获取每个网站的内容,这是我考虑的做法:
import urllib2, re
string = "search string"
source = urllib2.urlopen("http://website1.com").read()
if re.search(word,source):
print "My search string: "+string
我该在Python中搜索字符串,但速度太慢。有什么方法可以加速吗?