Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python webscraper stack overflow

import urllib2
from BeautifulSoup import BeautifulSoup
# or if you're using BeautifulSoup4:
# from bs4 import BeautifulSoup

soup = BeautifulSoup(urllib2.urlopen('http://example.com').read())

for row in soup('table', {'class': 'spad'})[0].tbody('tr'):
    tds = row('td')
    print tds[0].string, tds[1].string
    # will print date and sunrise
Comment

PREVIOUS NEXT
Code Example
Python :: sublime autocomplete python 
Python :: how to add keyboard to python turtle 
Python :: beautifulsoup find element containing text 
Python :: python excel sheet import 
Python :: python global keyword 
Python :: AttributeError: __enter__ in python cde 
Python :: propositional logic python 
Python :: how to add all values in a list python without using sum function 
Python :: get_int python 
Python :: code a gui 
Python :: how to kill python process started by excel 
Python :: add border to table in python pptx 
Python :: How to install proxy pool in scrapy? 
Python :: python beautifulsoup load cookies download file from url 
Python :: jupyter notebook morse code francais 
Python :: projects for beginners in python to complete 
Python :: run shell script to yaml file 
Shell :: chrome inspect devices 
Shell :: conda install seaborn 
Shell :: uninstall skype from ubuntu 
Shell :: stash untrack files 
Shell :: linker `cc` not found 
Shell :: bash: gedit: command not found 
Shell :: update composer ubuntu 
Shell :: how to check windows powershell version 
Shell :: uninstall npm ubuntu 
Shell :: conda install xlrd 
Shell :: kill port in linux 
Shell :: ngrok brew 
Shell :: free port in linux 
ADD CONTENT
Topic
Content
Source link
Name
9+2 =