[python] Read html file and practice scraping

Introduction

When I was scraping and stumbled, I think that I often analyze elements with copy outer HTML, but I forgot, so make a note

reference

Python 2nd grade How scraping works Experience and understand! Learn in conversation!

How to do

Create a file with the copied HTML and read it

from bs4 import BeautifulSoup

with open('copy.html', encoding='utf-8') as f:
    html = f.read()

soup = BeautifulSoup(html, 'html.parser')

Recommended Posts

[python] Read html file and practice scraping
Practice web scraping with Python and Selenium
Read and write csv file
Read and write a file
Read json file with Python, format it, and output json
[Python] Read the csv file and display the figure with matplotlib
Scraping with Node, Ruby and Python
View photos in Python and html
Scraping with Python, Selenium and Chromedriver
Scraping with Python and Beautiful Soup
Python memo ① Folder and file operations
Create and read messagepacks in Python
[Scraping] Python scraping
Read file
Read CSV file with python (Download & parse CSV file)
Getting Started with Python Web Scraping Practice
Copy file and rewrite cell value @python
Read the file line by line in Python
(Python) HTML reading and regular expression notes
Read the file line by line in Python
Read Python csv and export to txt
Getting Started with Python Web Scraping Practice
Read and write JSON files in Python
See file and folder information on python
Try HTML scraping with a Python library
Easy web scraping with Python and Ruby
[Python] Read the specified line in the file
[Automation] Read mail (msg file) with Python
Read and format a csv file mixed with comma tabs with Python pandas
Read the file with python and delete the line breaks [Notes on reading the file]
Read CSV file with Python and convert it to DataFrame as it is
Python scraping notes
Script python file
Python Scraping get_ranker_categories
Scraping tabelog with python and outputting to CSV
Scraping with Python
I tried web scraping using python and selenium
File DL, byte value and delete in Python3
Read a file containing garbled lines in Python
Scraping with Python
Read JSON with Python and output as CSV
Receive and display HTML form data in Python
Python --Read data from a numeric data file and find the multiple regression line.
Read table data in PDF file with Python
[Python] How to read data from CIFAR-10 and CIFAR-100
Python Scraping eBay
Python file processing
Fourier transform the wav file read by Python, reverse transform it, and write it again.
Output python log to both console and file
Practice applying functions and global variables in Python
Python Scraping get_title
[Python3] Read and write with datetime isoformat with json
[Python / Chrome] Basic settings and operations for scraping
Python: Scraping Part 1
Run a Python file from html using Django
Beginners practice Python
Read line by line from a file with Python
Scraping using Python
[python] Read data
Python: Scraping Part 2
Dynamic HTML pages made with AWS Lambda and Python