Total Beginner - Extracting Data from a Database Online (Screenshot)
Dave Angel
davea at davea.name
Fri May 24 21:16:37 EDT 2013
On 05/24/2013 07:36 PM, Carlos Nepomuceno wrote:
>
> <SNIP>
> page = urllib2.urlopen("http://example.com/page.html").read().strip()
>
> #to create the tables list
> tables=[[re.findall('<TD>(.*?)</TD>',r,re.S) for r in re.findall('<TR>(.*?)</TR>',t,re.S)] for t in re.findall('<TABLE>(.*?)</TABLE>',page,re.S)]
>
>
> Pretty simple. Good luck!
Only if the page is html, which the OP's was not. It was an image. Try
parsing that with regex.
--
DaveA
More information about the Python-list
mailing list