Python practical unpopular knowledge sorting
1.print print information with color
You know the print function in Python. Generally, we will use it to print something as a simple debugging.
But you know, the font color printed by Print can be set.
A small example
def esc(code=0):
return f'\033[{code}m'
print(esc('31;1;0') + 'Error:'+esc()+'important')
After running this code on the ...
Posted by GreenCore on Mon, 07 Mar 2022 15:51:02 +0100
Ant colony algorithm to solve TSP problem - python implementation
Ant colony algorithm for TSP problem
Introduction to TSP issues
Traveling businessmen need to visit n cities and finally return to the starting city. They are required to visit each city only once. The optimization goal is to minimize the sum of distances.
Example solution results
20 city coordinates: (88, 16), (42, 76), (5, 76), (69, 13), ...
Posted by daredevil88 on Mon, 07 Mar 2022 15:45:01 +0100
Data mining job FCM algorithm
1.MATLAB program implementation
The code is as follows:
%% Clear environment variables
clear;
clc;
close all;
%% Initialization parameters
data = rand(400, 2);
figure;
plot(data(:, 1), data(:, 2), 'ro', 'MarkerSize', 8);
xlabel 'Abscissa X'; ylabel 'Ordinate';
title 'sample data ';
K = 4; % Number of classifications
maxg ...
Posted by Hamish on Mon, 07 Mar 2022 15:38:16 +0100
From 0 to 1, proficient in automated testing, pytest automated testing framework, configuration file pytest ini
1, Foreword
The pytest configuration file can change the operation mode of pytest. It is a fixed file pytest INI file, read the configuration information and run it in the specified way
2, ini configuration file
Some files in pytest are non test files
pytest. Ini is the main configuration file of pytest, which can change the default be ...
Posted by orison316 on Mon, 07 Mar 2022 12:50:33 +0100
Intelligent route planning of MyCobot manipulator head
I've been struggling whether to talk about the head movement first or the spatial coordinate system first. Later, I decided to talk about the head movement first, so that we can first feel how the manipulator is positioned in space, and then we will introduce in detail the spatial coordinates of the manipulator in the next section. Spatial coor ...
Posted by Labbat on Mon, 07 Mar 2022 12:46:58 +0100
python data analysis tool
python data analysis tool
The data analysis function of python itself is not strong, so we need to install some third-party extension libraries to enhance its corresponding functions.
Extension library related to python data analysis and mining;
expanded memory bankbrief introductionNumPyProvide array support and corresponding efficien ...
Posted by MissiCoola on Mon, 07 Mar 2022 12:37:01 +0100
Requests cache improves crawler efficiency
When we are reptiles, we often these situations:
The website is complex and will encounter many repeated requests. Sometimes the crawler is interrupted unexpectedly, but we don't save the crawling state. If we run again, we need to crawl again.
There are such problems.
So how to solve these repeated crawling problems? You probably think of ...
Posted by gavinandresen on Mon, 07 Mar 2022 09:42:37 +0100
Python iterator, generator, decorator
iterator
Generally speaking, the process of extracting data from an object in turn is called traversal, and this means is called iteration (repeatedly execute a certain code block, and take the result of each iteration as the initial value of the next iteration).
Iteratable object: refers to the object that can be used for... in... Loop, such ...
Posted by mkubota on Mon, 07 Mar 2022 09:15:17 +0100
Python quick start series -- string -- detailed explanation
Python 0-1, lecture 2. In the last chapter, we learned variables and how to define a variable. From now on, we can use it directly. In this chapter, let's learn string. Let's have a look.
character string
What is a string? Is it important?
name = 'Hello World'
print(name)
'Hello World' here is what we call a string. Name is its variable. ...
Posted by sarakmo on Mon, 07 Mar 2022 07:40:10 +0100
python data structure
Arrays and linked lists
Array features
1. Continuous: sequential storage. 2. Fixed length: once defined, the length cannot be changed. 3. According to the subscript, you can directly access the elements of this subscript. 4. It is not suitable for inserting, deleting and other operations.
In python, the list is a dynamic array
Linked li ...
Posted by ldb358 on Mon, 07 Mar 2022 07:00:36 +0100