MIT License
If you have pip, just run pip install beautifulsoup4
Otherwise, download BeautifulSoup here, then extract the file and move the bs4
to wherever you're project is located.
Create a string:
activity = 'scraping'
Create an integer:
year = 2014
Arrays (in python, called lists):
some_numbers = [1, 2, 3, 4, 5]
Functions
def say_hello(name):
print 'hello ' + name
import urllib
url = 'http://alibaba.com/catalogs/products/CID100003006'
data = urllib.urlopen(start_url).read()
print data
import urllib
from bs4 import BeautifulSoup
url = 'http://alibaba.com/catalogs/products/CID100003006'
data = urllib.urlopen(url).read()
soup = BeautifulSoup(data)
for link in soup.select('a'):
print link.text.strip()