DescriptionEnumerate () is a python built-in function:
For an iterative (iterable)/Ergodic object (such as a list, string), enumerate makes it an index sequence that can be used to obtain both the index and the value
More for counting in a
Python's subprosess module is more powerful than the OS module, looked up some information it is to replace the old OS module, later to learn some subprocess module things, recently in the Learning network into, using the subprocess some usage, Now
Import of Packagesseveral ways to import
Import Package Name1 Import Time 2 time.time ()
Import package name, package name1 Import Time,sys 2 time.time () 3 Sys.path
From Package name Import module name1 from Import Time 2 Time ()
From
The following methods are seldom used and other solutions are used to summarize some other colleagues ' skills.1 How to automatically generate lists, plus a condition to filter[x for X in range (ten) if X>5]Try a dictionary in the afterlifeD =
#properties of the classclassA ():#defines a property of a class, similar to a static variable in C + +num=0def __init__(self):#Instance object property definition assignmentSelf.name ="HHA" defAdd (self):#invocation of class
Unit testing is a test that is used to verify correctness of a module, a function, or a class.Unit testing using the UnitTest module1) test the functionHere is a simple function that receives the first and last name and returns a neat
You don't know the PythonInteresting python features and amazing snippets of code.Python is a well-designed, high-quality, interpretive programming language that provides us with many features that make programmers feel comfortable. Sometimes,
1. A simple dictionaryAlien_0 = {' Color ': ' green ', ' Points ': 5}Print (alien_0[' color ')Print (alien_0[' points ')The dictionary alien_0 stores the aliens ' colors and points. Use two print statements to access and print this information, such
Learning Selenium has been one months, a simple summary of the steps to learn, convenient for later memories.I. Some concepts of automated testing1. Layered Automated Testing: unit-->service-->ui2. What kind of project is automated testing: software
First look at the Pycharm input file handle, how to display his definitionf = open (' student_msg ', encoding= ' utf-8 ', mode= ' A + ') # Opens a file, assigns a value to FThe print (Type (f), F) # f file handle belongs to a class called Input and
python basic Knowledge Directory function
The initial knowledge of the function
Name space
Application of function name and closure
Built-in function
Built-in functions overview
Map () Map function
Python Basic
>>> class P:pass...>>> type (P)>>> p = P ()>>> type (p)P is a template (mold), the example is through this template (mold),Added different initialization parameters to produce the specific product,can have multiple, and each specific product can
Variable:is to temporarily store the intermediate results of some operations in memory for subsequent code calls.1, must be any combination of numbers, letters, underscores, and can not start with a number.2. Cannot be a keyword in python.3.
Single-Case modeMultiple instantiation results point to the same instanceSingle-instance mode implementation methodWay One:1 ImportSettings2 3 classMySQL:4 __instance=None5 6 def __init__(self, IP, port):7Self.ip =IP8Self.port =Port9 Ten
List action MethodsAction on List LFor exampleList = range (1,5) #即 list=[1,2,3,4], with no last elementList = range (1, ten, 2) #即 list=[1, 3, 5, 7, 9]
List.append (obj)Add a new object at the end of the list2 List.count (obj)Count the number
First, exception handlingIn the process of running the program, you will always encounter a variety of errors. Program An error stopped running, then we can not let the program stop running it, this time we need to catch the exception, by catching
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