当前位置:网站首页>Lesson 1 Preparation
Lesson 1 Preparation
2022-06-25 20:43:00 【Osmanthus rice wine balls】
The first lesson preparation
( With https://movie.douban.com/top250 For example )
One 、 Find web address :
https://movie.douban.com/top250
Links to each page :url = ‘https://movie.douban.com/top250?start=’+ str(page*25)+’&filter=’(page It's the number of pages -1)
Two 、 Find the location of the data :
Method 1: Elements (element)
1.Fn+F12
2. Click on [ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-h9bUCdiE-1644636543579)(C:\Users\ litchi \Desktop\11.png)]
3. Click on the page content :
[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-oHpzYn7I-1644636543582)(C:\Users\ litchi \AppData\Roaming\Typora\typora-user-images\image-20220204143802608.png)]
We according to the Hierarchical structure Determine the data location :
[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-uAuwQR4t-1644636543582)(C:\Users\ litchi \Desktop\11.png)]
Method 2: The Internet (network)
headers: The request we sent
response: Request returned
3、 ... and 、 Coding standards
commonly python The first line of the program is to add ( In this way, Chinese... Can be included in the code )
#-*-coding:utf-8-*-
perhaps
#coding=utf-8
Used to test the program :( Define program entry )
def main():
print("hello")
if__name__=="__main__":# The underline has two , Call the function when the program executes
main()
Four 、 Introduce modules
Introduce your own modules :
[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-Z8aUO9Xg-1644636543583)(C:\Users\ litchi \AppData\Roaming\Typora\typora-user-images\image-20220204150503347.png)]
Modules introduced into the system :
1. Installation Library :
Method 1:
Click on Terminal
pip install Library name
eg:pip bs4
Method 2:
File->settings->Project douban->Project Intrpreter->±> Search for packages to install ->Install Package
2. Code
from bs4 import BeautifulSoup # Web page parsing , get data beautifulsoup4
import re # Regular expressions , Text matching
import urllib.request,urllib.error # Appoint URL, Get web data
import xlwt # Conduct excel operation
import sqlite3 # Conduct SQLite Database operation
t,urllib.error # Appoint URL, Get web data
import xlwt # Conduct excel operation
import sqlite3 # Conduct SQLite Database operation
边栏推荐
- Swin UNET reading notes
- From URL to access page rendering
- Avoid material "minefields"! Play super high conversion rate
- Leetcode daily [2022 - 02 - 18]
- 206. reverse linked list (insert, iteration and recursion)
- Interface automation -md5 password encryption
- Installing MySQL under Linux (CentOS 7)
- E-commerce project environment construction
- Causes and solutions of unreliable JS timer execution
- Section 13: simplify your code with Lombok
猜你喜欢
[distributed system design profile (1)] raft
Interviewer: why does TCP shake hands three times and break up four times? Most people can't answer!

Redis core principle and design idea
![[opencv] opencv from introduction to mastery -- detailed explanation of input and output XML and yaml files](/img/88/75c4caacef30e0621106a4e3462367.jpg)
[opencv] opencv from introduction to mastery -- detailed explanation of input and output XML and yaml files

Short video is just the time. How can you quickly build your video creation ability in your app?

Pcl+vs2019+opencv environment configuration

Share a billing system (website) I have developed

Li-rads lesion classification reading notes

Swin UNET reading notes
Section 13: simplify your code with Lombok
随机推荐
This is a simple and cool way to make large screen chart linkage. Smartbi will teach you
Is it safe to open an account with a mobile phone? Where can I open an account to buy shares?
[phase 23] phased summary of spring recruitment practice (Alibaba cloud has OC)
Instant aesthetics of the Centennial Olympic Games: beauty in the air, condensed in minutes and seconds - Alibaba cloud video cloud AI editorial department "cloud smart scissors"
CiteSpace download installation tutorial
8 minutes to understand the wal mechanism of tdengine
DICOM to NII
Cloud native 04: use envoy + open policy agent as the pre agent
How does zhiting home cloud and home assistant access homekit respectively? What is the difference between them?
R language momentum and Markowitz portfolio model implementation
Node connection MySQL
HMS core actively explores the function based on hardware ear return, helping to reduce the overall singing delay rate of the singing bar by 60%
Heavy update! Yolov4 latest paper! Interpreting yolov4 framework
Log4j2 vulnerability detection tool list
Recommend a free screen recording software
2022 "gold, silver and four" is a must for job hopping. You must know 100 questions in 2022 intermediate and advanced Android interview to realize your big factory dream
Inventory - those automated test interview questions you can't help but know
Li-rads lesion classification reading notes
Leetcode daily question - 28 Implement strstr() (simple)
6. exception handling