Today, after watching the teaching video at the Wheat Academy, I found that the income was quite abundant, so I made a study note (after all, it was the first time I wrote it, feeling a little low).Here is the code I hit with the teacher:#
The object that can be used for the For loop is called an iterative object (iterable), and the object can be iterated into:1. Collection data type: List, Turple, Dict, set, dir, etc.2.generator, including: Generator and generator functionsAn object
Recently in the study of Python, the use of the process has a list and dict declaration is very special, under this noteThe dictionary is a mutable object, the initialization must not be placed in front of the for loop before the list declaration
Recently in the study of Python, easy to make some records, to facilitate later review#字符串是不可再改变的序列Aa= ' ABCD '#aa [2:]= ' FF ' #报错, not directly assignable#字符串格式化: Use the format operator, or percent%, to implementprint ' Price of Aggs: $%d '%42mm=
#coding: Utf-81. #reverse方法将列表的元素反向存放, changes the original list but does not return a valuex=[5,2,4,3,8]X.reverse () #x [::-1] Do not change list reverse sortPrint X2. #sort方法用于在原位置对列表进行排序x=[5,2,4,3,8]X.sort ()Print
Def login (Username,password): " for user login :p aram username: User Enter user name :p aram password: user input password :return: true = Login Success ' f = open ' ("DB" , "R") for line in f: #一行一行检测
Different Python projects require a different library of dependenciesIt is recommended that you use your own virtual environment for each project. Refer to Python's three great
1.os-Normal Method:Os.name ():OS.GETCWD (): Gives the current directory, Python's current working directoryOs.listdir (): ReturnOs.remove (): DeleteOs.system (): Come to the shellOS.SEP: Supersedes the operating system-specific path
Variable: The program will use a lot of temporary storage data when running, this time use the variable, the name of the temporary data.Variables in Python do not need to be declared and can be used directly, and the data type of the variable is
Class Members: #字段 Normal fields belong to object execution only through object access A static field belongs to class execution that can be accessed either through an object or through a classclassFoo:def __init__(self,name):#FieldSelf.name
Dict DictionaryPutting data into dict: assigning directly, initializingPop Delete keySet Setadd elementRemove delete ElementThe string str is an immutable object, and the operation of the string will return a new stringPass doesn't do anything.You
1.Python multi-threaded, multi-processObjective to improve the concurrency1. An application that can have multiple processes and multithreading2. Default: Single process, single thread3. Single-process, multi-threadedIo operation, does not consume
Title: Simple Mainframe Bulk management toolDemand:
Host grouping
Show host group after login, select Group to view host list
Batch execution of commands, send files, and return real-time results
Host user name password can be
first, python installation of the pyenvInstall Python under Windows(1) open a Web browser and visit the official Python site http://www.python.org(2) Click download, or click on the homepage to download(3) Download the required version, currently
Python Bubble Sorting example details, python bubble
Three notes for Bubble Sorting:
1. You do not need to cycle all elements in the first loop.
2. Two-layer cyclic variables are associated with the first-layer cyclic variables.
3. The second
In Python, asyncio is used to encapsulate file read/write,
Preface
Like network I/O, file read/write is also a troublesome operation.
By default, Python uses system-blocking read/write. This means that if
f = file('xx')f.read()
Will block the event
Summary of else usage in Python loop statements, pythonelse
Preface
This article discussesfor…elseAndwhile…elseThese are one of the least commonly used and misunderstood syntax features in Python.
In Pythonfor,whileThere is an optionalelseBranch
Talking about the read and write permissions of python object data, talking about the python Read and Write Permissions
When writing large programs, object-oriented programming languages are more convenient and secure than process-oriented languages.
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