I. Points of attention in the socket process1. Sticky bag problemThe so-called sticky Packet refers to, in the TCP transmission, because the message sent out in the recipient are from the system's buffer, if more than one message backlog is not read,
Python, is an object-oriented, interpreted computer programming language.Python is suitable for the field:1.WEB Network and various network services2. System Tools and scripts3. As a "glue" language, the modules developed in other languages are
Build ListTo generate list [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], we can use range (1, 11):>>> Range (1, 11) [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]But what if you want to generate [1x1, 2x2, 3x3, ..., 10x10]? Method One is the loop:>>> L = []>>> for x in range (1
ImportTimemember=["Little Turtle","Small Pudding","Night","Stray","Ishin"]Print(Member,"\ n") member=[2,1,3,5,4]Print(Member,"\ n") Member.sort () empty=[]#Create an empty listPrint(member)#adds an element to the list.Member.append ("Lucky Lu Doll")#
Python Process Control(1) If Else statement:A, if statementPython's if statement is similar to other languages. The IF statement contains a logical expression, using an expression comparison, to make a decision based on the results of the
TCP Mode server sideThe server-side socket general process is this:
Create a socket (you can choose the socket type Inet,unix, etc., and the connection mode TCP/UDP)
Use bind to expose a port so that the client can easily connect
1. What is a socket?Sockets are also commonly referred to as "sockets," which describe IP addresses and ports, and are a handle to a chain of communication, where applications usually make requests to the network through "sockets" or respond to
Using the Environment window10+python3.4Install requests firstPYTHON3-M PIP Install requests1. Use the Youth Digest website first to see the resultsImport requests= Requests.get ("http://www.qnwz.cn/index.html") Print(html.content)If we want to
#Encoding:utf-8#you need to specify the encoding#Introducing SYSImportSYS#introduction of files in the same directoryImportfunction1#output a line of welcome informationPrint "Hello World"##basic Data type:#int#float#BOOL#Long###the array in Python:#
Defines a reflection to manipulate its members according to the form of a stringBefore I know about reflection, I'll look at the built-in method __import__, remember this built-in method?
__import__ for importing modules as strings
INP
The previous article on the installation of Nginx, Python, uwsgi process, here no longer repeat. The following are some of the processes and issues involved in the specific deployment processOne, because the use of BS4 (BeautifulSoup) \paste\lxml so
#! /usr/bin/env python #-*-coding:utf-8-*- ImportRedefChu (arg1):#define add and subtractarg = arg1[0]#beacuse Price was a list, so index 0arg = Arg.replace ('--','+'). Replace ('++','+'). Replace ('-+','-'). Replace ('+-','-')#Key Focus : A
One of the simplest serversPython has the ability to start a single server listening port, using the wsgiref of the standard library.
From wsgiref.simple_server import make_server def simple_app (environ, start_response): status = ' OK '
Fast sorting is often used because of the efficiency of the sorting efficiency in several sorting methods of the same O (N*logn).
The basic idea of this method is:
1. First, a number is taken from the series as the base number.
2. The partitioning
InstallationNormal situation, just
Pip Install pil==1.1.7
Or
Pip Install pillow==2.9.0
Can. But be aware of the output after installationWhen the installation is complete, be aware of the output:
TKINTER support is not available*** JPEG support
nginx Configuration
Ngnix, a high-performance Web server, is undoubtedly the darling of the present. Excellent performance, flexible and scalable, in the field of servers in the siege of the village, fighting the world.
Static files are an integral
Summary of string search operations in Python and python operations
Basic string location search methodPython searches for strings using variables. find ("content to be searched" [, start position, end position]), start position and end position,
String Replacement Operation example in Python, python example
String replacement (interpolation). You can use string. Template or standard string concatenation.String. Template indicates the character to be replaced. Use the "$" symbol, or use "$ {}
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