当前位置:网站首页>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
边栏推荐
- App battery historian master
- About eruake learning
- SQL statement select summary
- [deep learning series] - visual interpretation of neural network
- MySQL lock
- Yolov4 reading notes (with mind map)! YOLOv4: Optimal Speed and Accuracy of Object Detection
- MySQL installation tutorial
- Sonar series: continuous scanning through Jenkins integrated sonarqube (IV)
- 201604-4 test title: Game (BFS search maze)
- Is it safe to open an account with a mobile phone? Where can I open an account to buy shares?
猜你喜欢

Interface automation -md5 password encryption
MySQL lock
Boomfilter learning
Chrome plugin installation

Flexible scale out: from file system to distributed file system
Paddledtx v1.0 has been released, and its security and flexibility have been comprehensively improved!

Nnformer reading notes

JS canvas drawing an arrow with two hearts

2020-11-14-Alexnet
Live broadcast preview | front line experts invite you to talk: the value of data science enabling multiple application scenarios
随机推荐
Intra domain information collection for intranet penetration
A necessary programming assistant for programmers! Smartcoder helps you easily integrate HMS core
Understand the offline mixing technology in the industry
Usage Summary of str.format() function [not 'str****{}'.Format()]
CSDN sign in cash reward
R language quantile autoregressive QAR analysis pain index: time series of unemployment rate and inflation rate
Leetcode theme [array] -31- next spread
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"
Record some questions about MySQL (DNS reverse resolution in Linux)
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%
Skills of CCF question 2
Yolov4 reading notes (with mind map)! YOLOv4: Optimal Speed and Accuracy of Object Detection
Web components series (11) -- realizing the reusability of mycard
How to play one to many in JPA?
Flexible scale out: from file system to distributed file system
laf. JS - open source cloud development framework (readme.md)
MySQL installation tutorial
Huawei fast application access advertising service development guide
Several methods of obtaining function annotation text on pycharm
New generation engineers teach you how to play with alluxio + ml (Part 2)