Guest User

Untitled

a guest
Sep 29th, 2011
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.46 KB | None | 0 0
  1. import urllib
  2. from BeautifulSoup import BeautifulSoup
  3.  
  4. rawhtml = urllib.urlopen("http://www.01.ign.es/ign/layoutIn/sismoListadoTerremotos.do?zona=1&cantidad_dias=10").read()
  5. parsedhtml = BeautifulSoup(''.join(rawhtml))
  6.  
  7. qtable = parsedhtml.find('table')
  8. rows = qtable.findAll('tr')
  9. for tr in rows:
  10.     cols = tr.findAll('td')
  11.     for td in cols:
  12.         text = ''.join(td.find(text=True)).replace(' ',' ').strip()
  13.         print text+"\t",
  14.     print
  15.  
  16.  
Advertisement
Add Comment
Please, Sign In to add comment