DictDict is the abbreviation of dictionary, Python built-in dictionary, in other languages, also known as map, using key values to store, with a very fast search speed.If you are using list only, you will need two lists, look it up in the first list,
Program 2: Modify the Haproxy configuration fileDemand:11, check2 Input: www.oldboy.org3 get all records under the current backend4 52, New6 Input:7arg = {8 'Bakend':'www.oldboy.org',9 'Record':{Ten 'Server':'1
A dictionary is another mutable container model and can store any type of object.Each key value of the dictionary (key=>value) pairs with a colon (:) split, each pair is separated by a comma (,), and the entire dictionary is enclosed in curly braces
SMTP Send mailSMTP is the protocol for messages, Python has built-in support for SMTP, you can send plain text messages, HTML messages, and messages with attachments via PythoWhere Python only has smtplib and email two modules, email is responsible
First download the requests library from GitUnzip, put into the Python installation directory, select Requests Library, Shfit right mouse button, enter cmd, input python setup.py install, after running, enter import requests detect whether the
@property is an adorner, supported by the Python native library, without importThe function of @property is to turn a function into a property, generally acting on a member function within a class.First put a code to describe the meaning of the
Directory:
Python language Features
1 function parameter passing of Python
2 meta-classes in Python (metaclass)
3 @staticmethod and @classmethod
4 class variables and instance variables
5 python
CollectionA collection is an unordered, non-repeating combination of data, and its main functions are as follows:1, go to the weight, put a list into a set, it automatically go heavy2. Relationship test, test the intersection of two sets of data,
Requests is a simple and easy-to-use HTTP library implemented by Python, which is much simpler than urllib.Because it is a third-party library, CMD installation is required before usePIP Install requestsOnce the installation is complete, import it,
Python2 and Python3 in a little bit different, but for programming is not too big difference, in the release notes, Python2 official support until 2020, so when learning to use Python3 version: 1, the difference between print, In Python2, you can
Locating a group of objectsLocate a group of objects--find_elements_by_ ... (), note, here is elements, plural. The returned result is a list of values that we need to use to get the elements we want. There is so much to be aware of. See a piece of
The Shopping Cart Program sub-module programming, shopping cart 1 wrote the login section, the following rewrite the shopping section:#!/usr/bin/env pythonProduct_list = [[' Iphone7 ', 5800],[' Coffee ', 30],[' Tea ', 10],[' Python book ', 99],['
When using array, the operator * is used to calculate the quantity product (point multiplication), and the function dot () is used to calculate the cross product (cross-multiply).When using matrix, the operator * is used to calculate cross product,
Basic conceptsFunctional programming is a highly abstract programming paradigm, and functions written in purely functional programming languages have no variables. Therefore, any function, as long as the input is determined, the output is determined
Inheritance and polymorphismIn OOP programming, when we define a class, we can inherit from an existing class, the new class is called a subclass (subclass), and the inherited class is called the base class, the parent class, or the superclass (base
Inherited# One of the three main features of object-oriented: inheritance# Inheritance: There are at least two classes: what is the relationship of what, in order to avoid having the same code between several classes# Parent class: Animal#
Can name Meta-ancestor Namedtuplenamedtuple ExampleDeque Dual-ended queuedeque ExampleQueues QueueQueue ExampleAn ordered dictionary (key is kept in order) ordereddictordereddict ExampleWhen using a dictionary, if key does not exist, return a
Data encapsulationAn important feature of object-oriented programming is data encapsulation. In the above Student class, each instance has its own name and score this data. We can access this data through functions, such as printing a student's
#!/usr/bin/pytholn#-*-Coding:utf-8-*-Import MathImport SysDef print_13 ():#for I in range (10):man_age = Int (raw_input (' Enter input age:\n '))If Man_age >= and Man_age sex = str (raw_input (' Please input sex:m is the male or F a female and your
Python does not have {} to represent blocks of code, but instead uses indentation to indicate that the Python code was just started, without noticeIndentation, resulting in various errors ((╯-╰))The principle in Python is that the same level of code
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