ArgparseDescription
Handling optional and Positional parameters
Handles both optional and positional arguments
Produce standardized Help information
Produces highly informative usage messages
Parser supporting scheduling sub-
-------------------------------------------Font Color | Background Color | Color Description------------------------------------------- | | Black | | Red | | Green |
__str__: Used to print the return value of the __str__ directly at print (object)1 classAnimal:2 def __init__(self, name):3Self.name =name4 def __str__(self):5 returnSelf.name6 7D = Animal ("Dog")8 Print(d)__fun_name: Private method1
The test system is: Centos 6.7The Python version is: 3.6.4Scripting features: Conversion of common units, where memory is used to simulateImport Pstuildef Bytes2human (n): symbols = (' K ', ' M ', ' G ', ' T ', ' P ', ' E ', ' Z ', ' Y ')
at present, the overall failure. the reason may be because of the watercress verification code problem, because I do not see the login time interface, so I can not analyze the link of the verification code. (I login with my own browser is the
This article was transferred from: Liang blog (http://biangbiang.cnblogs.com)One problem to be aware of when using json.dumps >>> import json >>> print json.dumps('中国') \u4e2d\u56fd输出的会是中国中的ascii 字符码,而不是真正的中文。 这是因为json.dumps
8day1. Data type: TupleTuples: A collection of ordered, immutable data. However, if you include other mutable elements, these elements are variable. Shown to tell others, here can not be modified;A = (1,2,3,4,5,[' 1 ', ' a '])2. Data type:
Fibonacci SequenceRefers to such a sequence of 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233,377,610,987,1597,2584,4181,6765,10946,17711,28657,46368 ... This sequence starts with the 3rd item and each item is equal to the sum of the first two items.
First, the concept of iterators:Iterator protocol: The internal containing __next__ and __iter__ methods is the iterator.Iterator protocols and iterative protocols:1. The For loop can be iterated.2. There are __iter__ methods in the interior of an
Bring your own Help documentation:1>>>Help (list)2Help onclassListinchModule Builtins:3 4 classList (object)5| List ()New Empty list6| List (iterable), new list initialized fromIterable's Items7|8|Methods defined here:9|Ten|__add__(Self, value,/)
A brief history of Python what is Python
An interpretive, object-oriented, high-level programming language with dynamic semantics
Python programming
is a programming language that allows you to maintain your own style when you program,
File Operation Trilogy: Open---operations--close.A. File operation, several commonly used modes:If you open the file, do not specify the mode of operation, the default is read;For r/r+, if the file does not exist will be an error, the use of the
Operation Steps of the crawler:Reptile three-Step walk
Reptile First step: Use requests to get data:1. Import Requests2. Use Requests.get to get the Web source
Import REQUESTSR = Requests.get ('
Python crawlers fool the browser by replacing the http request header to implement login, pythonheader
Take Douban as an example, access the https://www.douban.com/contacts/list to view their attention, You need to log on to view.
If you use the
Python _ builtins _ classmethod class (11 ),
11. For 'classmethod', the modifier's function does not need to be instantiated and the self parameter is not required. However, the first parameter must be the cls parameter representing its own class
(2) The first program and the first program
1. Installation
Download python3.6.4 from https://www.python.org/downloads/.
If you are a windows \ mac computer, double-click the installation package, one way to next, if you are linux please refer to
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