There are two types of Python loops, one is the for...in loop, the second is a while loop, and as long as the condition is met, the loop is repeated, and the condition is not satisfied when exiting the loopnames = [‘Michael‘, ‘Bob‘, ‘Tracy‘]for name
Window installationInstallation of Python:1. Go to the official Python website to download the installation packageClicking on the Downloads in the navigation bar will automatically identify your Windows system and you will see the installation
Concurrency: The system has the ability to handle multiple tasks (actions)Parallelism: The system has the ability to simultaneously handle multiple tasks (actions)Synchronization: When the process executes to an IO (waiting for external data), it
Software:Pip Install PYZMQCode:==server.py## Hello World Server in Python# binds REP socket to tcp://*:5555# expects "Hello" from the client, replies with "World"#Import ZMQImport timeContext = Zmq. Context ()Socket = Context.socket (ZMQ. REP)Socket.
read the official documentation to meet your daily needs, and the official documents are translated in Chinese to facilitate learning. But these are basic grammar and common modules, Python learning is important module, fast and efficient
Random ModuleRandom , as the name implies, is used to generate , the specific usage is as followsImport Randomlis = [1,2,3,4,5,6,7,8,9,10] #随机生成浮点数print (Random.random ()) floating-point number between #随机返回0 to print (Random.uniform (1,10))
Programming method
1, process-oriented programming: According to business logic from top to bottom code to implement the function
2, functional programming: to encapsulate a function code in the function, the use of the same
The map () function, which receives two parameters, one is a function, the other is a sequence, and map () acts on each element of the sequence in turn, and returns the result as a new sequence;AA = [1, 2, 3, 4, 5]print ("", List (map (Lambda a:a *
Today is the first day of the system to learn python, understand the development of language, mainly divided into three stages, machine language---> assembly languages---> high-level language.Machine language: Is the language that can make the
Thread queue describes the type of queue:
FIFO:
Queue.queue (maxsize=0)FIFO is the first in. The queue provides a basic FIFO container, which is simple to use, and MaxSize is an integer that indicates the upper bound
if __name__ == "__main__:", there may be some execution statements later. What is the purpose of adding this judgment?When the Python compiler reads the source file, it executes all the code it finds, and the value of the variable __name__ is __main_
#!/usr/bin/env python#_ *_ Coding:utf-8 _*_#Author: Liujindong#datetime: 2018/6/11 16:34‘‘‘This program is a shopping cart program, including user portal, merchant entrance.User Portal: Purchased goods, Balance records.Merchant Entrance: You can add
Python because of the existence of Gil (Global lock), can not play the advantages of multi-core, its performance has been plagued by criticism. However, in IO-intensive network programming, asynchronous processing can increase hundreds of times more
1.logging ModuleLevel of the 1.1logging moduleDebug debuggingInfo recordWarning potential hazardsError errorsCritical serious.1.2 Output logs in a fileImportlogginglogging.basicconfig (filename='Log.test.log', level=logging.info,#it will only be
Python Numpy Shape Basics UsageThe shape function is a function in Numpy.core.fromnumeric, whose function is to read the length of the matrix, for example, Shape[0] is to read the length of the first dimension of the matrix. Its input parameters can
Let's "move" with Python. A python variable A is mentioned in all of the above objects, and it is specifically noted that it has a label: tag. In fact, whether it is called "variable" or "tag" does not have a specific requirement, called it
Python: function recursiondefinition : The function itself is called directly or indirectly in the process of invoking a function, called a recursive call. Recursive calls can call up to 999 layers.Base model:def func (): Print ('fromfunc')
Given a string, find the length of the oldest string that does not contain repeating characters.Example:Given "abcabcbb" that the oldest string without repeating characters is "abc" , then the length is 3.Given "bbbbb" , the longest substring is,
Python Bulk Modify file name #coding: utf-8 import os # all files in the current directory files = os.listdir () for filename in files:# split file name and suffix name portion Span class= "OP" >= os.path.splitext (filename) # compare suffix
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service