From my contact with Python crawler began, intermittent learning to now will get started, has passed one months, found that the crawler is really a vast project, involving a very wide range of knowledge. I am here mainly to share the things I
Python Object-oriented
Beginner's article:
The origin of program designIntroduction to object orientation and reasons for birthThe composition of object-oriented programsThree main features of object-oriented First, the
Strip () is used to remove the left and right spaces, or to specify which characters to remove in parentheses, for example: \ n>>> sql = input ("sql>") SQL>>>> sql = input ("sql>") SQL>SADDSA>>>>>>Print(SQL)#there are spaces on both sidesSADDSA>>>>>>
Right triangle of Chinese character graphicsDescribeGet a Chinese character entered by the user, output as a shape (here with asterisks instead of Chinese characters):Requirements arranged neatly, note: The output of the above graphic, blank space
Import subprocessimport redef get_length (filename): result = subprocess. Popen (["Ffprobe", filename], stdout=subprocess. PIPE, stderr=subprocess. STDOUT) for x in
1. What is the difference between a list and a normal variable?Lists are data types, and normal variables are used to store data.You can assign a list to a normal variable2. Existence List A = [11, 22, 33], how to add (increment) A new element to
The types of variables in Python do not need to be defined and are automatically recognized. (Real, Integer, Boolean type can be related operations)I. Definition of variables1) variables are only used in order to store data, variables are defined
Whether you're a novice to python or a palm, this article will always be a part of your harvest, probably just a matter of degree. Well, not far away, to the point, the following share this system before you still have to let Python do
Requirements Analysis:If the Python script does not run on a machine that does not have Python installed, the script is packaged as an EXE file, reducing the scripting's dependency on the environment and running more quickly.Of course, the packaged
First, the basic1. The suffix of the file is. py2. Two modes of executionPython interpreter. py file pathPython enters the interpreter for real-time input and gets execution results3. Interpreter Path#!/usr/bin/evn python
Brief introductionSimplehttpserver is a Python 2 comes with a module, is a Python Web server, simple and small, fast start.It has been incorporated into the Http.server module in Python 3.The usage of simplehttpserver in Python 3 is similar to that
When we develop the program, sometimes need to develop some automated tasks, after the completion of the results automatically send a copy of the message, Python send mail using the Smtplib module, is a standard package, direct import imports using,
Python object-oriented 1, class definition#定义类class Emp: pass2. Static variablesclass Emp: #静态变量,通过类直接访问 id = 100 #__开头的是私有属性 __age = 20#通过类直接访问print Emp.id3. Constructors and instance methodsA fixed constructor name is the __init__
1. function to manually pass self, method to self2. If it is a function, use the class name to call, if it is a method, use the object to callTo illustrate:class Foo (object): def__init__ (self): self.name="Haiyan" def func
Compiled language: Through the compiler, the source code compiled into binary language files, the machine easier to execute, high efficiency, debugging changes are more troublesome.Explanatory language: The source code is translated into machine
Compile type: Each statement of the source program is compiled into a machine language, and stored as a binary file, so that the computer can run the machine directly in the language to run the program, fast;interpreted type: only in the execution
Lambda expression
Start with lambda
Follow a certain parameter (if any)
Parameters are separated by a colon and an expression theme
Just an expression, so, no return
# 计算一个数字的100倍数stm = lambda x: 100 * x stm(89)Map
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