1. Database Operation stepsWith Sqlite3 you need to import the package sqlite3, the database needs to be connected to the database and then the cursor cursor is created.When the program finishes running, you need to close the cursor before closing
First, comments# Notes\ n Line Delimiter\ Continue on line"* * * *" multi-line CommentII. Basic Rules: Separate code block (group) header $ tailIndent block statement code blocks are distinguished by indentation depthBlank line for splitting
Defined
Method
List
Can contain different types of objects, you can add or subtract elements, can be combined with other lists or a list of split, using [] to define the eg:alist=[123, ' abc ', 4.56,[' inner ', ' list '],7-9j]
1At first I uploaded the Run.exe file packaged on Windows directly to Linux and thought it could be used directly. But./run after the error. Baidu later know that theprogram on Windows can not run on LinuxLinux under the executable can be a suffix
I. Use of file operations
1. Open a file and read the contentsFormat: Open ("File name", modify the encoding type). Read ()1 variable = open (" filename ", encoding="utf-8"). Read ()2 print (variable) #读取文件中内容Note: windows= default GBK
Matplotlib is a powerful toolkit for Python drawing and data visualization.Installation method: Pip Install MatplotlibReference method: Import Matplotlib.pyplot as PltDrawing function: Plt.plot ()Display Image: Plt.show ()Simple example:Import
1. Iteration 1.1 FeaturesIn Python, an iteration is done through a for ... in.Python's for loop can be used not only on a list or a tuple, but also on any other object that can iterateA For loop can work on an iterative object far more than
Directly into the theme, the following routines:1. Select Manual Input LicenseLicense Number input: cn123-12345-12345-123452, in the next step, select the second item, copy the request code3. Run the following script:where Licenseid input: cn123-1234
Dictionary
A dictionary consists of a key-value pair, consisting of a key (name) and a value that differs from the list and tuple is that the element inside is a key (name), So when you want to print the dictionary, print the dictionary
Differences between raise and assert in Python one, throwing exceptions using raisePython can automatically trigger an exception, raise ( built-in function ) is defined as the thrown exception that is displayed, the user can use raise to judge,
1. Two ways to execute a python script(1). Interactive mode: Start the Python interpreter and execute the command (2). Scripting: Python xxx.py or chmod +x &&./xxx.py2. Briefly describe the relationship between bits and bytesA bits is the smallest
#测试目的: RABBITMQ Message Distribution Polling#1. Start two receive ports and sleep for 30 seconds in Callbackup.#2. The send port sends the data.#3. When the first receive receives the message, the first program aborts immediately.#4. Check to see if
1. Guess the number of small games#!/usr/bin/python#-*-coding:utf-8-*-ImportRandomPrint "-------------------------------------"Print "Welcome to the guessing number games written by Aniuzaixian"Print "+++++ Please read the rules of the game +++++"s=
1. Find any hexadecimal number in a larger body of text\b[0-9a-fa-f]+\b 2. Check whether a text string holds just a hexadecimal number\a[0-9a-fa-f]+\z 3. Find a hexadecimal number with a 0x prefix\b0x[0-9a-fa-f]+\b 4. Find a hexadecimal number with
Python module and package mechanisms: import and from... import ..,
Use import or from... import in python to import the corresponding module.
The module is actually a collection file of some functions and classes. It can implement some
Python traversal sequence enumerate function analysis, pythonenumerate
The enumerate function is used to traverse the elements in the sequence and Their subscript.
Enumerate function description:
Function prototype: enumerate (sequence, [start = 0])
Python3 Regular Expression and python3 Regular Expression
1 ''' 2 Regular Expression, also known as a rule expression, is often abbreviated as regex, regexp, or RE in code. It is a concept of computer science. 3. Regular tables are usually used to
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