Previous articles on regular matching I used only one re.search.But in fact, the regular RE module provides a lot of very useful methods, we first look at the RE module has those attribute methodsIn front of a bunch of _ or uppercase is not
code example:# Small application: survey, record the investigator's name and answer, ask whether to continue. # Use the data dictionary, while, input (), title (), and upper (). Responses = {}flag = Truewhile flag: name = input ("\ n Please enter
Write CSV file source code:1 #output data written to CSV file2 ImportCSV3data = [4("Mike","male", 24),5("Lee","male", 26),6("Joy","female", 22)7 ]8 9 #Python3.4 New way to solve the problem of empty lineTenWith open ('D://write.csv','W', newline="')
1. Namespaces and ScopesNamespace: Where the name is stored, the exact name space is where the name and the value of the variable are bound.Namespaces have a total of three namespaces, both:1. Built-in namespaces: generated when the Python
Installing a third-party library appears Python version 2.7 required, which is not found in the registryCreate a file register.py content as follows.Import sysfrom _winreg import *# tweak as necessary version = Sys.version[:3]installpath =
Use Linux+ipython,ipython to install during practicePython meta-character# Meta Characters:# . ^ $ * + ? {} [] \ | ()
. Match all characters except line break
\ metacharacters represent the matching
Python installation package:There are two main packages to install: PIL and pytesser ,tesseract(1), Installation pil::http://www.pythonware.com/products/pil/After the download is an EXE program, directly double-click the installation(2),
First, the automation test code at the beginning is linear, followed by the development of modular code, so involves the functions and methods of reference.1. The most important differences between functions and methods:When defining a function in a
Import Module StatementsThe module is a py file, The module name is the py file name is removed. Py,import is followed by the module name, different modules can be placed in different packages (that is, the folder, from the back of the package name),
Tuple collectionMeta-groupSame as the list, save the data, but he is a read-only list and cannot be changedName = ("AAA", "BBB")Dir (name) #把传入的数据类型 all the way back in the form of a listHelp (name)The role of tuplesN2 = List (name) tuples are
1. Strip () function
Function prototypesDeclaration: S is a string. RM is the sequence of characters to be deletedS.strip (RM): Remove the beginning and end of the S string. The characters in the RM delete sequenceS.lstrip (RM): Removes the
Global variables in the Python moduleI want to implement a Python module, which has some configuration items that can be read and modified. One possible solution is to write these configuration items into a file called settings.py.Now I have a
What is a program?Program is equal to the data structure plus algorithm, then the data structure is a static thing, the algorithm is a dynamic thing, we write this program in a new language, we have to consider that the language is mainly by the
I. Overview of CSS1. IntroductionCSS is an abbreviation for the English cascading style sheets, called Cascading style sheets, to beautify the page. There are three ways to exist: element inline, page embedding, and external introduction, comparing
1, there are four numbers: 1, 2, 3, 4, how many can be composed of different and no repetition of the number of three digits? What's the number? 2. The bonus awarded by the Enterprise is based on the profit commission. Profit (I) less than or equal
1. Select the address where the project is stored by default
The default address is C:\Users\Lee, which is the address of the CMD console, and after the project is created, the command django-admin startproject project_test default address creates
This article mainly introduced the Python programming string correlation operation, combined with the instance form analysis Python string correlation function and the common operation skill, needs the friend to refer to the next
The examples in
Packaging
1. Why encapsulation?
Encapsulation is to hide the specifics of the details of the data properties and methods, providing only one interface. Encapsulation can be used without caring about how the object is built
2. Encapsulation includes
Basic Requirements:User Portal2. Press Q to exitRealize:1. Use the list and dic2. If judgment while and for loop3. Use documents to record product information and shopping records" "Shopping Cart User Portal1, the product information exists in the
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