On Wed, 12 Nov 2008 02:07:46 -0800 (PST), [EMAIL PROTECTED] wrote: [snip] > > import urllib > import urllib2 > import re > import MySQLdb > > conn=MySQLdb.connect > (host="localhost",user="root",passwd="ylj",db="net", charset="utf8") > cur = conn.cursor() > sql='select > net_site.downline_re,net_site.down_re,net_cha.id, > net_cha.urlid,net_cha.source_url > from net_site,net_cha where net_site.id=net_cha.urlid' > cur.execute(sql) > re=cur.fetchall()
This line will hide the "re" that you imported 10 lines before. > if len(re)!=0: > for i in re: > down_re="%s"%(i[1]) > source_url="%s"%(i[4]) > data= urllib2.urlopen(source_url).read() > res=re.compile(down, re_DOTALL).findall(data) > print str [snip] I'm guessing that the "re" returned by cur.fetchall doesn't have a "compile" function. -- To email me, substitute nowhere->spamcop, invalid->net. -- http://mail.python.org/mailman/listinfo/python-list