What do you want to save?
Add Code snippet
New code examples
-
Python 2022-01-24 19:41:56
bs4 table examples python
data = [] table = soup.find('table', attrs={'class':'lineItemsTable'}) table_body = table.find('tbody') rows = table_body.find_all('tr') for row in rows: cols = row.find_all('td') cols = [ele.text.strip() for ele in cols] data.append([ele for... Add solution -
Other 2022-01-22 19:36:19
web scraping print all p and h2 tags
import requests from bs4 import BeautifulSoup url = 'https://www.python.org/' reqs = requests.get(url) soup = BeautifulSoup(reqs.text, 'lxml') print("List of all the h1, h2, h3 :") for heading in soup.find_all(["h1", "h2", &q... Add solution -
Python 2021-12-23 17:35:09
get title attribute beautiful soup
for body in message.find_all('div', {'class': 'body'}): # grab div by class name if body.find('div', {'class': 'date'}): text = body.find('div', {'class': 'date'}) # find div by 'title' attribute title = text.get('title', 'No title attribu... Add solution -
TypeScript 2021-11-22 02:55:18
how to extract comments from word python
#!/usr/bin/env python # Given a .docx file, extract a CSV list of all tagged (commented) text # This is version 6.0 of the script # Date: 12 February 2020 import zipfile import csv from bs4 import BeautifulSoup as Soup import tkinter as tk from tkinter ... Add solution -
Python 2021-11-18 16:43:13
export html table to csv python
# Importing the required modules import os import sys import pandas as pd from bs4 import BeautifulSoup path = 'html.html' # empty list data = [] # for getting the header from # the HTML file list_header = [] soup = BeautifulSoup(op... Add solution -
Python 2021-11-06 20:08:24
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... Add solution -
Html 2021-11-04 04:02:16
python regex in html
>>> from bs4 import BeautifulSoup >>> soup = BeautifulSoup("<p>Some<b>bad<i>HTML") >>> print soup.prettify() <html> <body> <p> Some <b> bad <i> HTML import re print(soup.... Add solution
Best helpers
Ranking is empty