Beautiful soup is used for html file parsing
Beautiful soup 4 converts complex HTML documents into a complex tree structure. Each node is a Python object. All objects can be summarized into four types:
TagNavigableStringBeautifulSoupComment
Test file: baidu.com html
Please put the file contents in the root directory of the project
File content
<!DOCTYPE html>
<html>
< ...
Added by JasonO on Wed, 12 Jan 2022 11:00:07 +0200
Slicing operations for lists
Slicing operations for lists
How to create a list
Way to create a list: literal syntax list1 = ['apple', 'orange', 'pitaya', 'durian'] print(list1) The second way to create a list: constructor syntax list2 = list(range(1, 10)) print(list2) The third way to create a list: generative (deductive) syntax list3 = [i for i in range(1, 10)] print ...
Added by saku on Wed, 12 Jan 2022 10:24:59 +0200
Principle and implementation of ten sorting algorithms [python version]
0 Preface
During the algorithm interview, the interviewer will generally ask "what is the time complexity of this algorithm? What is the space complexity? How is its stability?". In order to answer this kind of questions clearly, I combed the basic sorting algorithm. If you master these classical methods, you can do well in the c ...
Added by DimArchon84 on Wed, 12 Jan 2022 09:23:22 +0200
"Python programming from introduction to practice" -- while loop
the for loop is used to create a code block for each element in the collection, and the while loop runs continuously until the specified conditions are not met. General form of while statement in Python: while judgment condition: execute statements also pay attention to colons and indents. In addition, th ...
Added by horsefaceba on Wed, 12 Jan 2022 08:34:03 +0200
A few tips to make your Python code more Python
When we first started learning python, we understood the coding style requirements of Python. We can see its specific description by entering import this through Python terminal.
This is the famous "python Zen". In short, it is to write python compliant code, which is concise, elegant and readable.
Here are some common Python ...
Added by mjgdunne on Wed, 12 Jan 2022 07:56:25 +0200
seaborn, a detailed data visualization artifact, can quickly realize the visualization of statistical data
Hello, everyone. Seaborn, which is based on Matplotlib, is a Python library for making statistical graphics. The content of this article is long. It is recommended to read it slowly after collection.
Seaborn's advantages:
Rich charts, easier to use than matplotlib Combined with pandas Support value type multivariable diagram Support value ...
Added by Zallus on Wed, 12 Jan 2022 07:08:46 +0200
Common python scripts and online websites of ctf
script
Picture blasting width and height script in Knowledge points of ctf misc picture questions in
Binary to QR code
Before running, change the image side length, that is, the value of MAX. for example, the binary string length is 625 (25 * 25), which is changed to 25 here
import PIL
from PIL import Image
MAX = 25 #Picture side lengt ...
Added by thoand on Wed, 12 Jan 2022 05:12:36 +0200
Crawler series: collect through web forms and login windows
In the last issue, we explained Data standardization For relevant content, first sort the frequency of words, and then convert some case to reduce the repeated content of 2-gram sequence.When we really step out of the basic door of network data collection, the first problem we encounter may be: "how can I get the information behind the log ...
Added by CanMan2004 on Wed, 12 Jan 2022 03:43:45 +0200
Data visualization - Matplotlib [task 1]
1, One of the simplest drawing examples
The image of Matplotlib is drawn on figure (such as windows, Jupiter form), and each figure contains one or more axes (a sub region that can specify the coordinate system). The easiest way to create figures and axes is through Pyplot Subplots command. After creating axes, you can use axes Plot draws ...
Added by mattfoster on Tue, 11 Jan 2022 18:05:08 +0200
Batch recognition of invoices based on Python and input them into Excel table (nanny tutorial)
The official account: yk Kun Emperor The background replies to the invoice identification and obtains all the source code
1. Scene description
2. Prepare the environment
3. Extract content
1. Withdraw invoice amount 2. Name of the seller 3. Extraction of taxpayer identification number 4. Drawer
4. Batch identify invoices and save them to ...
Added by listenmirndt on Tue, 11 Jan 2022 16:01:15 +0200