1. SlicingTaking a list or tuple element is a very common operationL = ['hello','the','World', ' and','my','love' ]Take first three elements L[0:3],l[:3]Take the first element of the countdown: L[-1] (Index of the first element of the
Requirement: Given a folder path, traverse all files within the folder as well as subfolders within the file, when all files with suffix WAV format are converted to OGG format files.
import os# 获取目录下的所有文件列表
import fnmatch# 文件格式筛选模块,筛选指定格式文件
First, CentOS installation pil#especially important, otherwise it will be an error.Yum Install python-Develyum Install libjpeg libjpeg-devel zlib zlib-devel freetype freetype-devel lcms lcms-Develyum Install Python-Imaging#This address is faster, if
1. The first sentence of the Python statementPrint "Hello,world"Execute file: Python hello.py2. VariablesNote: variable names can only be any combination of letters, numbers, or underscores when defining variables, the first character of a variable
First, preface1.1 A brief description of regular expressionsA regular expression is a look-up and string substitution operation. Regular expressions are widely used in text editors, such as regular expressions, that are used to:1. Check whether the
In the field of system management, we often use e-mail to send management information, business quality statements, etc., to facilitate the first time operators to understand the service status of the business. Through the Python smtplib module to
One:Writing the Login interfaceBasic requirements: Let the user enter the user name password Show welcome message after successful authentication Exit the program after a three-time error1.dic methodname_info={'Zhang':'123'}count=0
Guess the age of the game:Game rules:
Allow users to try up to 3 times
After each attempt 3 times, if not guessed right, ask the user whether still want to continue to play, if the answer Y or Y, continue to let it guess 3 times, to
Job Requirements:1. User input account password to login2. The user information is saved in the file3. User password input error three times after locking the userSAMPLE 1:by LiuSteps:1. String read into dictionaryUser_info ='eric:123456#catherine:09
The meaning of a constant does not exist in PythonYou can only use uppercase names to indicate that this assignment is a constant, which is actually a variableCharacter encodingIn-memory is UnicodeThe hard drive is utf-8.Middle need to convertPython
Directory:One, routing system URL1. Django Request life cycle2. Create a Django Project3. Configuration4. Writing ProceduresSecond, the ViewThird, the templateFour, ORM operation Content:First, the URL 1. Django Request life cycleURL
The content of this section1 iterators and adorners2 Decorators3 Json and Pickle data serialization4 Software Catalog Structure specification5 Jobs: ATM project developmentOne decorator1 adorners:2 Definition: The essence is a function, (decorating
More important Ndarray object properties in an array of numpy:Ndarray.ndim: The number of dimensions (that is, the number of array axes) of the array, equal to the rank. The most common are two-dimensional arrays (matrices). ndarray.itemsize: The
The content of this article
Python Introduction
Installation
First Program (Hello,world)
Variable
User inputs (input)
Data type
Data operations
If judgment
The difference between break and continue
While
The odd number within the traversal of print 10 is the error message "Taberror:inconsistent use of tabs and spaces in indentation" appears:The code is as follows:The first feeling is nothing wrong, but when I set the display "Space and tab", the
1 #-*-coding:utf-8-*-2 #LC3 #List-generated4 deffunc (x):5 Print(x)6 return*x7 Print([Func (i) forIinchRange (10) ])8 9A = [i*2 forIinchRange (1000000000000)]#This list generation takes up a lot of memory space, and the list already exists
Objective:Three Ways to Program
Object-Oriented: Classes (Class)
Object-oriented: Process (Def)
Functional Programming: function (Def)
Definition: function vs. processIn Python, a function is a programmatic way to structure or
6. High-order features
6.1 Iterations
Given a list or tuple, we can traverse the list or tuple through a for loop, which we call iteration (iteration). In Python, an iteration is done through a for ... in.
Because Dict storage is not ordered in list
A solution to empty rows during conversion from a python file string to a list !,
The file content is as follows:
Alex 100000 Rain 80000 Egon 50000 Yuan 30000 # There is a blank line here!
Now let's see how to handle it and convert it to a list!
ConfigParser module and configparser module InstallationI. Introduction
Used to generate and modify common configuration documents. The name of the current module is changed to configparser in python 3.x.Ii. Configuration File
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