I used Java (Android) all the time. I used Java to write APIs, and php also tried it. because of work, it takes less time on the web, I feel hard to use it in my spare time. Today I read Python, a highly efficient development language, on the
Chapter01 text 1.1 string-text constants and templates
Function: contains constants and classes for processing text.1.1.1 Functions
Maketrans ()
Translate () ': modifies a group of characters to another group of characters.
1.1.2 TemplateUse string.
1. Remove spaces and special symbolsCopy codeThe Code is as follows: s. strip (). lstrip (). rstrip (',')2. Copy a stringCopy codeThe Code is as follows: # strcpy (sStr1, sStr2)SStr1 = 'strcpy'SStr2 = sStr1SStr1 = 'strcp2'Print sStr23. connection
The Python break statement breaks the minimum closed for or while loop in the C language. The break statement is used to terminate a loop statement. That is, if the loop condition does not have the False condition or the sequence is not completely
The list of function parameters defined in Python can be amazing, mainly including variable parameters with non-Keyword variables and keywords.Variable Length Parameter
First, we define the following functions:
def tuple_var_args(arg1,arg2='default
I. Data Type 1. integer, long integer, floating point, plural
In python, it is particularly important to note that the plural is composed of the real number and the virtual number. real + imag (j/J) are both floating-point numbers, where the suffix
A linked list consists of a series of structures that do not need to be connected in the memory. These objects are sorted in linear order. Each structure contains table elements and pointers to subsequent elements. The pointer to the last unit
After installing python in my ubuntu, I checked all the environment variables and found no PYTHONPATH? It does not have much impact on my use of python. There are many ways to solve the Path Problem of the module I have written. But now I want to
1. Stack
Stack is a table that only supports insert and delete operations in one position. It is the end of the table and is called the top of the Stack ). The basic stack operations include PUSH (in stack) and POP (Out stack ). Stack is also called
Python objects can be copied in the shortest copy and deep copy modes.
The analysis of these two copies is very beneficial in "python core programming", so it is recorded here.
Id () method: the id () method can view the ID of an object, similar
004. Improve Our mini gamesPython comparison operator:> Left is greater than right>>> 1 True>>> 1> 3False> = Greater than or equal to the right on the left= Left equals right! = Left is not equal to right
Condition branch Syntax:If
File Replication in python
The python OS module has many file directory-related functions, but does not provide functions for directly copying files. Of course, you can copy files by writing both sides. You can use the shutil module to directly
Copy codeThe Code is as follows:# Coding: UTF-8"""_ New _ and _ init _ are the same thing. Let's look at the following code:If the _ new _ method is not defined for a class, the _ new _ method is inherited from the parent class._ New _ run before _
Copy codeThe Code is as follows:Import time
Def block (file, size = 65536 ):While True:Nb = file. read (size)If not nb:BreakYield nb
Def getLineCount (filename ):With open (filename, "r", encoding = "UTF-8") as f:Return sum (line. count ("\ n") for
Copy codeThe Code is as follows:Python 3.3.4 (v3.3.4: 7ff62415e426, Feb 10 2014, 18:13:51) [MSC v.1600 64 bit (AMD64)] on win32Type "copyright", "credits" or "license ()" for more information.>>> Cast = ["cleese", "palin", "jones", "idle"]>>> Print (
Someone asked me on Twitter why Python uses the 0-based array index (0-based), and gave me a link to the relevant excellent articles. This reminds me of a lot of past events: one of the predecessor of Python, the ABC language uses the array index
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