Liaoche python Tutorial
Generator section, there is a Yang Hui's topic.
The Yang Hui's triangle is defined as follows:
1
1 1
1 2 1 1 3 3 1 1 4 6 4 1 1-5 Ten 5 1
Think of each row as a list, try writing a
the difference between generators and iterators in Python (code is tested under Python3.5):
num01–> iterator
Definition:
For container objects such as list, string, tuple, dict, and so on, it is convenient to use a For loop traversal. Invoke the
Container data type collections
source code: Lib/collections/__init__.py
This module implements specialized container data types that provide alternatives to Python's general-purpose built-in container, dict,list, set, and tuple.
namedtuple () is
1. What is NumPy
Machine learning is commonly used in a scientific computing library called NumPy:
NumPy is an array of matrices. is a multidimensional array object, called Ndarray.
Such as:
Import NumPy
a = Numpy.array ([[[[1,2,3,4],
Depth learning training needs to mark the location and category of images, used before is called Bbox-label-tool-master, the encounter of large images is not complete, there is no adaptive scaling, this is the improved Python script.
Directory
Beginners Base64 Code, make a note
First, write a simple example:
Encodes a string and then decodes it, this example comes from the https://docs.python.org/2/library/base64.html
>>> Import base64
>>> encoded = base64.b64encode (' Data to be encoded
1. When CentOS is updated to python2.7, the arrow keys cannot be used normally:
The original address of this problem (thank the author for sharing): hereThe arrow keys in the diagram are all escaped and are very inconvenient to use in interactive
As an interpretative scripting language, there is essentially no reflection at all. Because any string can be interpreted as code.
There are eval in Perl, which is also in Python, but is subdivided into eval and exec.
This can be regarded as the
Enumerate () descriptionEnumerate () is a Python built-in function enumerate the dictionary is enumerated, enumerated meaning for an iterative (iterable)/Ergodic object (such as lists, strings), enumerate it into an index sequence, It allows both
List function:
Converts a string into a list, for example:
>>> name = list (' hello ')
>>> name
[' H ', ' e ', ' l ', ' l ', ' O ']
List Basic functions:
1. Change list: element assignment
Using index tags
>>>x = [1, 1, 1]
>>>x[1] =
Most layers of Caffe are written by C + +, and the network can be trained quickly with the help of C + + efficiency. But sometimes we need to write a bit of input layer to deal with a variety of different data input, for example, because you need to
First, Quick start1, Python does not support the C language of self-increase and self-reduction operations 2, the Python string has its own index: The index of the first character is 0, and the last character's index is-1 3, the PRINT statement
The basic principle of reptiles
Crawlers are automated procedures for acquiring and retrieving Web pages and storing information .
Get Web page:Access to the Web page is to obtain the source code, as long as the source to get down, you can
1. BackgroundDue to the need to write a Python program, a regular, large number of Htttp requests are sent, and the results are processed.Refer to the other code with the process pool and record it.2. Multi-Process vs multithreading
In a C +
Python regular expression re-module other methods1:search (pattern,string,flags=0)Find a match in a string2:findall (pattern,string,flags=0)Find a match, return the list of all matching partsIn [1]:ImportReIn [2]: str1 ='Imoooc videonum ='In [3]:
One, the basic process of file operation.The computer system is divided into three parts: the hardware, the operating system and the application.Applications that we write in Python or other languages need to be saved on the hard drive if we want to
Python GRPC Overview:GRPC is a Google open source RPC (remote program call) framework that can be easily cross-lingual, cross-platform programming with GRPC protocol (based on HTTP2).
Rpc:Remote procedure call, which is translated is a long-
Return by default in the function returns none, if more than one return value is specified, it is encapsulated into a tuplefunction parametersThe order of the parameter definitions must be: required, default, variable, named keyword, and keyword
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