1. Self in PythonThe self in Python is equivalent to the this pointer in C + +Which is the pointer to the object itself.Self.name = name is the member variable of the current object name is assigned to name.2.python of self.__class__Represents the
Urllib.request.urlopen (URL). read (). Decode (' Utf-8 ')Error in URL with Chinese parameter: unicodeencodeerror: ' ASCII ' codec can ' t encode characters in position 84-86:ordinal not in range (128)Need to transcode in Chineseurl =
1 defDeco (func):2 def_deco ():3 Print("before")4 func ()5 Print("End")6 #Return func here does not need to be returned7 return_deco#This is not _deco ()8 9 @decoTen defmyfunc (): One Print("clled") A -MyFunc
CSV is the abbreviation for comma-separated values, which is a form of tabular data stored in a text file, such as the following table:Can be stored as a CSV file with the following file contents:No.,Name,Age,Score1,Apple,12,982,Ben,13,973,Celia,14,9
Python's Hashlib module provides some common encryption featuresFor example, get the MD5 checksum value of the string ' Nobody inspects the spammish repetition 'In []: Import Hashlibin [further]: M=HASHLIB.MD5 () in [+]: m.update (' Nobody inspects '
Recently there is a monitoring requirement, you need to execute the script on each node of the cluster remotely, and get the result of the script execution, in order to be safe, do not need the account password to log in the host, require only the
List = [1,2,3,4,5,6,7,8,9,0,0,0,0,0]listset = List.set (list) #将列表中的数据进行去重处理此时listSet中的数据为 [1,2,3,4,5,6,7,8,9,0]index = List.index (2) #返回数据元素首先出现的位置, if the list does not have this element returns an error at this point the index is 1[[0 for I in
The source code of Cjkpython was downloaded from the SourceForge.net website, and the command was used very directly in it.Python setup.py BuildError found: Unable to find Vcvarsall.batUsing one of the three artifacts notepad++ in the source package
List: is a variable with a sequenceSpecific Use method:1. Statements=["aaaaaa", "bbbbbbbb"];2. Access the first elementS[0]3. Access to the first element of the countdownS[-1]4. Add an element after the last elementS.append ("CCCCCCCCCCCC")5.
We can bind a lot of properties to an instance, what if some attributes do not want to be accessed externally?Python's control over property permissions is implemented by property names, which cannot be accessed externally if an attribute starts
Similar to attributes, methods are also divided into instance methods and class methods .All defined in class are instance methods, and the first argument of the instance method is the instance itself.To define a class method in class, you need to
Automated Nginx server reverse proxy configuration method, automated nginx
It would be nice to reduce too many external isolated APIs and simplify deployment details.
In my previous articles, I explained "some benefits of using reverse proxy ". In
Python converts html tables into CSV files,
This example describes how to convert an html table to a CSV file using python. Share it with you for your reference. The details are as follows:
Usage: python html2csv. py *. htmlThis Code uses the
Class instances implemented by python are used to search for files and replace the content,
This example describes the classes implemented by python to search for files and replace the content. Share it with you for your reference. The specific
Python write log encapsulation instance and python instance
This example describes how to write logs in python. Share it with you for your reference. The details are as follows:
# Encoding: utf-8import sysimport loggingimport timedef writeLog
Python partial functions
When a function has many parameters, the caller needs to provide multiple parameters. If the number of parameters is reduced, the caller's burden can be simplified.
For example, the int () function can convert a string to an
Python Study Notes (1) -- list and tuple, pythontuple
List: a variable sequence.
Usage:
1. StatementS = ["aaaaaa", "bbbbbbbbbb"];
2. Access the first elementS [0]
3. The last elementS [-1]
4. Add an element after the last elementS. append
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