<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#ffffff" text="#000000">
<font class="fixed_width" face="Courier, Monospaced">my code <br>
---------------------------------------------------------------------------<wbr>----------------
<br>
# -*- coding: utf8 -*- <br>
#!/usr/bin/python <br>
</font>
<p><font class="fixed_width" face="Courier, Monospaced">import urllib <br>
import urllib2 <br>
import re <br>
import MySQLdb <br>
</font></p>
<font class="fixed_width" face="Courier, Monospaced">conn=MySQLdb.connect
<br>
(host="localhost",user="root",passwd="ylj",db="net", charset="utf8") <br>
cur = conn.cursor() <br>
sql='select <br>
net_site.downline_re,net_site.down_re,net_cha.id,net_cha.urlid,net_cha.sour<wbr>ce_url
<br>
from net_site,net_cha where net_site.id=net_cha.urlid' <br>
cur.execute(sql) <br>
re=cur.fetchall() <br>
if len(re)!=0: <br>
&nbsp; &nbsp; &nbsp;for i in re: <br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;down_re="%s"%(i[1]) <br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;source_url="%s"%(i[4]) <br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;data= urllib2.urlopen(source_url).read() <br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;res=re.compile(down, re_DOTALL).findall(data) <br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;print str <br>
---------------------------------------------------------------------------<wbr><br>
when it's run,the eric give error <br>
------------- <br>
The debugged program raised the exception unhandled AttributeError <br>
"'tuple' object has no attribute 'compile'" <br>
File: /var/www/py/down.py, Line: 27 <br>
------------ <br>
the line:27 -------&gt; res=re.compile(down, re_DOTALL).findall(data) </font>
</body>
</html>