[BangPypers] help me~!!!'tuple' object has no attribute 'compile'
ViswaBharathi
viswabharathi at gmail.com
Wed Nov 12 11:44:34 CET 2008
Problem here is both module name and variable name is same 're'.
It should be like as follows,
*rec*=cur.fetchall()
if len(rec)!=0:
for i in rec:
On Wed, Nov 12, 2008 at 4:02 PM, yao <ylj798 at gmail.com> wrote:
> my code
> -------------------------------------------------------------------------------------------
>
> # -*- coding: utf8 -*-
> #!/usr/bin/python
>
> 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()
> 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
> ---------------------------------------------------------------------------
> when it's run,the eric give error
> -------------
> The debugged program raised the exception unhandled AttributeError
> "'tuple' object has no attribute 'compile'"
> File: /var/www/py/down.py, Line: 27
> ------------
> the line:27 -------> res=re.compile(down, re_DOTALL).findall(data)
>
> _______________________________________________
> BangPypers mailing list
> BangPypers at python.org
> http://mail.python.org/mailman/listinfo/bangpypers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/bangpypers/attachments/20081112/7c0801fc/attachment-0001.htm>
More information about the BangPypers
mailing list