List:A = [' A ', ' B ', ' C ', ' abc ', 1, 2, 3]Print a# append is added by default in the lastA.append (4)Print aOutput: [' A ', ' B ', ' C ', ' abc ', 1, 2, 3, 4]# The Index method is able to see what the subscript index of the 4 element is in the
"One: The role of *,-1"Give you two examples: 1 a,b,c,d= " spam " 2 print (a) 3 print (b) 4 print (c) 5 print (d) 6 a,*b= " Spam " 7 print (a) 8 print (b) The above example is the most simple example of the function of
An introductionConstraints are the same as the width of the data type, which are optional parametersRole: To ensure the integrity and consistency of dataMainly divided into:PRIMARY Key (PK) identifies the field as the primary key of the table and
Re moduleUsed to match an operation in a regular expression.In Python, in order to avoid the implementation of the output ' \ ', the ' \ n ' character escape problem (such as regular expressions using backslashes "\" to represent a special form or
Objective:Inheritance is one of the three main features of object-oriented, so you should pay attention to 3 points for inheritance.first, the basic searchIf the subclass inherits the parent class, the child class instantiates the object, and no
for x in ...A loop is a statement that puts each element into a variable and x then executes the indented block . Note: Formatting in Python also acts as a syntax rule, and indenting a block is an examplesummation problem, comparison and similarity 1
Overall outlineOne1,int. Number: operation. 1, 2,3 ...2,bool. true: false.3,str. Simple and small amount of storage data, and the corresponding operation name = ' Alex ',4,tupe. (1, ' Alex ')5,list: Large amount of data, [1, ' ses ', true,[1,2,3],{'
9 Higher order functions(1) the map () function receives two parameters, one is the function, and the other is iterable,map the incoming function to each element of the sequence, and returns the result as a new iterator.list(map(str, [1, 2, 3]))(2)
number Numeric type : Used to store numeric values, because the data type does not allow changes, so changing the value will reallocate the memory space.string operator : string concatenate + duplicate output String * Get the characters in a string
Write a little every day, one day I can become more salty saltedPython in the operation of the file and directory is basically dependent on the Os,shutil module, which takes the main OS module, the most important examples of several methods are as
Wrote a Kafka transmission message, celery the script that publishes the task.There are four threads that read different Kafka queue information separatelyThe problem is that only the first thread will start, and the remaining three lines thread
__call__ in Python, the function is actually an object:>>> f = abs>>> f.__name__ ' abs ' >>> f (-123) because F can be called, so, F is called a callable object. All functions are callable objects. An instance of a class can also become a callable
integral type -usually referred to as an integer or integral, is a positive or negative integer, with no decimal points.
long integer-an infinite number of integers, and the integer is finally an uppercase or lowercase L.
float
Write a little every day, one day I can become more salty saltedI. File reading and writingExamples are as follows:1 #!/usr/bin/env python2 #-*-coding:utf-8-*-3 " "4 Read the file5 " "6 defread_file (filename):7 #Open the file as read-only, the
variable Assignment: variable assignment does not require a declaration type, each variable must be assigned before it is used, and the variable will not be created until the variable is assigned. Multiple variable assignment: a=b=c=1 a,b,c value is
This, of course, refers to Linux or UNIX, as in the case of a bash script.# !/usr/bin/python Print ('of life... ')Anyway, I suggest that even if you don't use an interpreter at the beginning, the script is much better than the interpreter's toy, and
My first python web development framework (11) -- tool function Package Description (2), pythonweb
Db_helper.py is a database operation package. It has two main functions: read () database read operation function and write () database write
Learn Python 3 best getting started Book recommendation (with free online reading download link), python online reading
Select your own Python entry books based on your actual situation:
No programming basics at all: Book 01
A small number of
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