Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

iterate over meta tag python

import urllib.request
from bs4 import BeautifulSoup

f = open('out.txt','w')

url = "http://www.international.gc.ca/about-a_propos/atip-aiprp/reports-rapports/2012/02-atip_aiprp.aspx"
page = urllib.request.urlopen(url)

soup = BeautifulSoup(page)

soup.unicode

table1 = soup.find("table", border=1)
table2 = soup.find('tbody')
table3 = soup.find_all('tr')

for td in table3:
    rn = soup.find_all("td")[0].get_text()
    sr = soup.find_all("td")[1].get_text()
    d = soup.find_all("td")[2].get_text()
    n = soup.find_all("td")[3].get_text()

    print(rn + "," + sr + "," + d + ",", file=f)
Comment

PREVIOUS NEXT
Code Example
Python :: sphinx select code ' 
Python :: make a effective figure in python 
Python :: roll a dice 
Python :: taggablemanager serializer django 
Python :: gnome-terminal stopped executing after python 3.6 is installed 
Python :: bolumden kalan python 
Shell :: classic confinement requires snaps under /snap or symlink from /snap to /var/lib/snapd/snap 
Shell :: remove phpmyadmin from ubuntu 
Shell :: ubuntu restart sound 
Shell :: ubuntu remove kite 
Shell :: restart postgres ubuntu 
Shell :: list npm packages installed globally 
Shell :: how to remove mysql workbench in ubuntu 
Shell :: crontab use nano 
Shell :: Warning: heroku update available from 7.47.4 to 7.47.5 
Shell :: nginx.service is not active, cannot reload. 
Shell :: mysqlclient install ubuntu 
Shell :: npm show registry 
Shell :: flush dns cmd 
Shell :: reinit gitignore 
Shell :: linux ext-zip * 
Shell :: uninstall postgres brew 
Shell :: git username 
Shell :: zoom download ubuntu 
Shell :: How to add username and password in github 
Shell :: npm install legacy peer deps 
Shell :: uninstall anydesk ubuntu 
Shell :: wifi password from command prompt 
Shell :: adb reverse tcp 8081 
Shell :: yarn nodemon 
ADD CONTENT
Topic
Content
Source link
Name
4+4 =