InstallationUse the PIP command to install the Redis-operation library.Pip Install RedisOperationImport RedisOperating the Redis database in Python is straightforward, and commands are almost identical to the commands for working with the Redis
The SYS module is an interface that interacts with the Python interpreter.SYS.ARGV command line argument list, the first element is the path of the program itself.Sys.exit (n) exits the program, exits normally exit (0), error exits Sys.exit
-pow (x, y) function: Calculate xy, how much do you want to count?Example: Pow (2,100) 1267650600228229401496703205376Floating-point arithmetic has indeterminate mantissa, not a bugExample: 0.1 + 0.2 0.30000000000000004 indeterminate mantissa-round (
for inch [1, 2, 3]: Print (Element)Can for...in ... As an iterative objectAn iterator is an object that remembers where to traverse. The iterator object is accessed from the first element of the collection until all of the elements have been
Decorative Device, in short, adds additional functionality to the function without altering any code of the original function, including the invocation. What is special is that the return value of the adorner is also a function.first, the
One: Two ways to open a process (* * * * *) fromMultiprocessingImportProcessImport TimedefTask (name):Print('%s is running'%name) Time.sleep (3) Print('%s is done'%name)#on the window system, the operation to turn on the subprocess must be placed
R: Represents the handling of non-escaping phenomenaIn Python, u represents a Unicode string that is encoded using Unicode, no U represents a byte string, and the type is str, and is ASCI encoded by default when no encoding is declared. If you want
In actual development, we sometimes encounter the need for data export. In general, the exported file format is in Excel form.Then, the Excel build is appropriate to pull out a separate common method to implement:1 defGenerate_excel (Excel_name,
First, the file reading and writing modeThe python file is simple to read and write, just an open function.Open file methods are:Open (absolute path/' file name ', read-write mode, encoding= ' Utf-8 '), opening this way file, after operation, to
I. WedgeYou want to pass a data between two programs, you need to use network communication.Two. Architecture of software development:The first kind: Application class: QQ,, network disk, Youku This category belongs to the desktop application that
Python OS module important points of knowledgeThis is very important, mainly about the file path, I have stepped on a lot of pits, today summed up, convenient to avoid the path associated with the various pits!1, first we want to get all the folders
__init__Called after the class instance is created, some initialization of the instance of the current object, no return value __name__A system variable that identifies the name of the module __call__Whether it can be called __main__Main module
ImportLoggingdeflogger (): Logger= Logging.getlogger ('Logger') #括号里面默认是root Logger.setlevel ('DEBUG') #设置等级是DEBUG, the number is 10,info is 20,warning is 30,error is 40,criticle is the _format= Logging. Formatter ('[% (name) s]% (asctime) s%
#如何修改文件, we know that the file has been stored on the disk, later to be updated or modified, only after the original file appendedUse F=open ("Wenjian_name", "r+", encoding= "Utf-8")Here the "r+" refers to read-write, can also be replaced by "A +"
First, the type of the function1. No parameter functiondef sum_2 ():# # Definition of functionNUM1 = Tennum2 =result = Num1 + num2print "%d +%d =%d"% (NUM1, num2, result)sum_2 ()# # function's call2, the parameter function (formal parameter and is
1) min (2,4) # # to find the minimum value2) Max (2,4) # # to find the maximum value3) sum (range (1,100,2)) # # sum4) Enumeration: Returns the index value and the corresponding value valuefor I, V in enumerate (' Hello World '):Print str (i) + V #
This article mainly introduces the detailed operation method of list in Python, including create, access, update, delete, other operation, etc., the friend who need can refer to.1. Create a list. Just enclose the comma-separated data items in square
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