1. Basic usagePython provides a standard log interface, which is the logging module. The log level has debug, info, WARNING, error, critical five (level in turn), respectively, the corresponding function is debug (), info (), WARNING (), error (),
A class property is a variable belonging to a class, like a static member variable of a class in C + +, you simply define the property in the domain of all methods, that is, the class property, but usually immediately following the class name, the
Q&a Reference ConnectionProblem:ioerror: [Errno 2] No such file or directory.Os.path.exists () returns a value of 0 if the directory does not exist.Therefore, if you use this function as follows, you will get the error described in problem, and the
Conditional statementsifare all old friends, direct code example, simple and easy to get started:>>> lang = "python" >>> if lang = = "C": ... Print "C language" ... elif lang = = "Java": ... Print "Java language" ... else: Print "Python
1. Version issuesPython2. X and python3.x are incompatible, so if you choose the 2.X version, then to avoid compatibility issues, you will need to select the corresponding version later when using other Python libraries or tools.: https://www.python.
1.isinstance functions: In addition to a type as a parameter, you can also use a type tuple as a parameter.Isinstance (obj,basestring) ===isinstance (obj, (str,unicode))2.getattr function: You can give a default value to avoid triggering an
The mutual conversions between list tuples and strings in Python need to be leveraged, tuple (), list (), str ().Examples are as follows:>>> the_string ="Hello I ' am xiaoli!">>>#string conversion to tuple>>> the_tuple =tuple
Multiprocessing. Pipe ([duplex])Returns 2 Connection objects (CONN1, conn2), which represent both ends of the pipeline, and the default is two-way communication. If DUPLEX=FALSE,CONN1 can only be used to receive messages, CONN2 can only be used to
JSON is actually a string representation of a Python dictionary, but a dictionary cannot be passed directly as a complex object, so it needs to be converted to a string. The process of conversion is also a serialization process.Serialize to JSON
Regardless of the language, we need to pay attention to performance optimization problems, improve execution efficiency. Choosing a scripting language will endure its speed, which in some way illustrates the inadequacy of Python as a scripting
Recently in the reptile, the use of nature is the famous scrapy. However, in the installation of Scrapy encountered a lot of problems, the first problem is that Scrapy is only compatible with Python2.7 above version. And my machine is still using
Python learns Day 9 property multi-inheritance Mixin, pythonmixin
When binding an attribute, If we expose the attribute directly, although it is easy to write, but we cannot check the parameter, so we can change the score as needed:
s =
Python xlrd can be used to read the excel date type.
There is an excle table that needs to be filtered and written to the database, but the cell of the date type is a number, so the solution is queried.
Basic code structureCopy codeThe Code is as
Python outputs all text information in the PowerPoint file,
This example describes how to output all text information in a Python PowerPoint file. Share it with you for your reference. The specific analysis is as follows:
The following code
Several data structures in the python collection module (Counter, OrderedDict, namedtup)
The collection module has several data structures that we may use.
Counter is a sub-class of the dictionary and is responsible for counting a dictionary. It
Set the variable access permission in Python.
In the Class, attributes and methods can be available, while external code can directly call the method of instance variables to operate data, thus hiding the internal complex logic.
However, from the
How to Use pngquant to compress png images in Python,
When it comes to png Image Compression, many people may know the website TinyPNG. However, if the PS plug-in requires money (although cracked), the Developer API will be connected to his server.
Introduction to multiple threads in the python threading module, pythonthreading
Python supports multiple threads and native threads. It is mainly implemented through the thread and threading modules. Thread is a relatively underlying module, and
Python collection type Usage Analysis, python collection usage
This article analyzes the usage of python set types. Share it with you for your reference. The specific analysis is as follows:
The collection type of python is similar to that of other
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