PEP8 Python Coding Specification Collation
07/17. 2014
Decided to start the Python road, using spare time, for more in-depth study of Python. Programming languages are not art, but work or tools, so it is necessary to organize and
I/O Model:Synchronous (synchronous) IOAsynchronous (asynchronous) IOBlocking (blocking) IONon-blocking (non-blocking) IOFor a network IO (read example here) occurs when two system objects are involved, one is the process or thread that calls this IO,
Generate a random number in 1~10:For loop: All the objects that can be traversed can be used for a for loop, such as a string.Len (list), the type of elements in the list can be different, you can directly use subscript to assign values to the list
String common methods Capitalize ()
String.capitalize () capitalize the first letter of the string
Operation Result:XiaomingCount ()
String.count () Number of occurrences of statistical characters
name = ' Xiaoming ' name_
One, OS platform programming requirements1. Operation of directory filesHow to manipulate the system directory and file2, the timing of the implementation of the program3, the conversion of the executable programThe conversion of a Python program to
operational requirements and preliminary thinkingEmployee Information Form procedures, to achieve additions and deletions to check the operation:① can be used for fuzzy query , the syntax supports at least the following 3 kinds :Select Name,age from
A range ([Start,] stop[, step]) is specified in the previous section of a, and a sequence is generated based on the range defined by start and stop and step set by step.Like what:>>> Range (5)[0, 1, 2, 3, 4]>>> Range (1,5)[1, 2, 3, 4]>>> Range (0,6,2
Recursive thinking is an important idea in algorithm programming.As a beginner, the recursive programming is very forced, each encounter needs recursion problem, in the heart there are 10,000 grass mud horse fly over ~~~~~~ (here omit 10,000 grass
When Python is programmed, it often deals with files and directories, which is not the OS module. The OS module contains common operating system features, regardless of the specific platform. The following list of commonly used commands1. Os.name ()-
1. Install Pyinstaller plug-inCMD command: Pip install PyinstallerPs. O.o don't know Easy_install Baidu Bar.2, Pyinstaller IntroductionHe can easily help me to package the Python script into an. exe program.CMD package directive: Pyinstaller [Some
Variables and AssignmentsName= ' Mike ' #这里一定要注意, if the value on the right is not a number, be sure to quote, otherwise the system will think that the right side is a variable, and the right side we want to be a value, so we need to add a single
from Import datetime # gets the current datetime Print (now) Print (now)class'datetime.datetime'>Gets the specified date and timeTo specify a date and time, we construct one directly with the parameter datetime : from Import datetime # To create a
Daniel should have a good understanding of the path, this article mainly for the introduction of small white like me to use common sense, ah haThe following paths are described for Windows, and other platforms are not very well known for the time
Functiondef function name (formal parameter): parameter not defined in front, local variableParametersMust parameter must be passed in the correct orderKeyword parameters can be added to the keyword without the need for proper sequence of
Coding problems have always been a headache when programming with Python, and the program often encounters the following error message:Unicodedecodeerror: ' ASCII ' codec can ' t decode byte 0x?? In position 1:ordinal not in range (128)This is
The content of this section:
Introduction to I/O Models
Blocking I/O (blocking IO)
non-blocking I/O (non-blocking IO)
multiplexed I/O (IO Multiplexing)
Asynchronous I/O (asynchronous I/o)
IO Model comparison and analysis
Python study notes,
I recently read the Python tutorial, so I will record some of it. If I read it myself later, the review will be faster.
Print ("I am ***", "What about you? ", True) # Replace the comma with a space and splice it with name =
Python3 uses Print to output a color font, python3print
Phton3 uses print to output color fonts.
Implementation process:The Character Color of the terminal is controlled by escape sequence. It is the system display function in text mode and has
[Python] UnicodeEncodeError: 'gbk' codec can't encode character solution,
Compiling a python script in windows causes serious Encoding Problems.
When writing network data streams to files, we will encounter several encodings:
1: # encoding = 'xxx'
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