NO1:"SQLite"Insert#Import SQLite driver:>>>ImportSqlite3#Connect to the SQLite database#The database file is test.db#If the file does not exist, it is automatically created in the current directory:>>> conn = Sqlite3.connect ('test.db')#Create a
Exam Scope:1. Python Basics2. Data type3. Process Control4.? Piece processing5. function6.? To an object##############1There are three properties for defining variables, respectively. What's the equivalent of the equals sign? is? What is the more? 2
Features of function Programming:1 immutable: Do not use variables to save state, do not modify variables# non-functional a = 1def incr_test1 (): Global a# Once you change a global variable and then call a, it's easy to mess up. A + = 1
Encounter such a problem. I want to count the number of py files in a folder.Can it be solved with python? Answer, can.Workaround, use GlobThe code is as follows:Import Globpath_file_number=glob.glob (pathname=r ' *.py ') print (path_file_number)
1.AOPThe same code and repetitive functions are extracted from the inside of different classes to be reused.The adorner is a well-known design pattern, which is often used for scenes with cut-off requirements, more classic insert logs, performance
1. ModuleModule: A python code a set of C language code a bunch of ready-to-use functions, classesFunction of the module: Save memory consumptionModule classification: Built-in Module expansion Module custom module2. Common Modules##########
Index and slice of a string1. IndexSet existing string s= ' ABCDEFG ', s[0] to start position, S[-1] as end2. Slicing What is a data typeint: Used to calculateBOOL: JudgingSTR: Small amount of data, operableList: Storing large amounts of data, such
Referenced from: 77502788Currently using ubuntu14.041. Add the python3.6 installation package and install it (you can also go to the official website to download the installation package)[HTML]View PlainCopy
code
Python Settings EnvironmentWhen Python is installed, the environment variable is set in the advanced language of the computer's properties.The path in the environment variable changes to Python's Tree directory. You can open the Python command from
For CPU-intensive programs, you can use packaged classes such as Multiprocessing's process,pool to implement parallel computations in a multi-process manner. However, because the communication cost in the process is relatively large, the efficiency
First, choose the sort Select_sort#Finds the smallest value in an arraydeffindsmallest (arr):#Stores the smallest valuesmallest =Arr[0]#Stores The index of the smallest valueSmallest_index =0 forIinchRange (1, Len (arr)):ifArr[i]
23 Object-oriented -----Special Methods1. Isinstance (obj, class name) determines whether an object is instantiated as such or instantiated by subclasses of this class.Class A:passClass B (A):pB1=b ()Print (isinstance(b1,b)) #
Formatted output:Name = QJAge = 30Job = ItSalary = 6000Example 1: string concatenation method, not recommended, because it will open up more memory space in memory.info = "----------info of" + name + "'---------Name: "+ name +"Age: "+ Age +"Job: ' +
Recursive
Invoking the behavior of the function itself
Have a correct return condition
def factorial (n):if n = = 1:Return 1Elsereturn n * Factorial (n-1)Number = Int (input (' Please enter a positive integer: '))result = factorial
NO1:"Pillow" Image processing Standard libraryScaling fromPILImportImage#open a JPG image file, note the current path:im = Image.open ('test.jpg')#Get image size:W, h =im.sizePrint('Original image size:%sx%s'%(W, h))#Zoom to 50%:Im.thumbnail (W//2,
Python sequence table Learn a bit, data structure and algorithm, do a summary. If it's not right there, please give me more advice.Sequential tables , in which elements are stored sequentially in a contiguous storage area, the order relationships
a prefaceThe core idea of Web UI Automation is to find elements, and then manipulate the two elements. In the Python Selenium series (ii) Element positioning method article, which describes how to find an element, this article describes the second
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