Recently learned about Python 错误处理 and several 测试 methods1 try exceptYou can try except catch an exception by wayTry: print (' Try ... ') r = 10/0 print (' result is: ', r) except Zerodiversionerror as E: print (' except is: ' , e)
Python3 condition Control 1, if statement general formThe general form of the IF statement in Python is as follows:If condition_1: statement_block_1elif condition_2: statement_block_2else: statement_block_3
If "condition_1" is
After the environment is set up, let's look at some simple uses of requests, including:
Requests commonly used request methods, including: Get,post
Use of session and cookie in requests library
Other advanced sections:
Python in the HTTP protocol interface related libraries have URLLIB,URLLIB2 and Reqeusts library, which Reqeusts library for the most convenient, so I also mainly use the requests library to do the interface test HTTP protocol. Let's start by
Lists are the most basic data structures in Python, and the list is the most commonly used Python data type, and the list's data items do not need to have the same type. Each element in the list is assigned a number-its position, or index, the first
1. Private properties(1) Dynamic propertiesHides the property in Python, starting with a double underscore. Names that begin with all double underscores in a class, such as __x, are automatically formed: the form of the _ Class name __x. The
ProblemWhen doing web-side UI layer Automation will encounter file upload operation, often a friend asked, here to summarizeSolution SolutionsThe first type: type=file upload file, similar to the followingYou can do this with code like
Uuid-universal Unique identifier, universal unique identifierApplication Scenarios:Unique flag for an objectThe main functions that the module contains are:
UUID1 ([node[, Clock_seq]])-timestamp-based
UUID3 ()-MD5 hash value based on
Python implements the operation of the file:You need to open a file before reading it:fileobj = open (filename, mode)Explanation of the Open () call parameter:* Fileobj is the file object returned by open ();* filename is the string name of the file;
The module implements different secure hashing algorithms, including but not limited to:
MD5
SHA1
SHA224
SHA256
SHA384
SHA512
Use the three-step curve:
Python reads a file on a per-line basis, with line breaks at the end of each line, which makes it very inconvenient for subsequent business processing logic to remove line breaks for each line. Look at the following case:>>> A ="Hello
Regular expressions provide the basis for advanced text pattern matching, extraction, and/or text-based search and replace functionality. Regular expressions are supported through the RE module in the standard library.Common regular expression
Python implements the operation of the file:You need to open a file before reading it:fileobj = open (filename, mode)Explanation of the Open () call parameter:* Fileobj is the file object returned by open ();* filename is the string name of the file;
It is well known that the Python file processing operation is convenient and fast, the following article mainly introduces the Python file operation of the merged text file content of the relevant information, the text through the sample code
At the time of the initial learning of Python, only the DOM and sax two parsing methods are known, but their efficiency is not ideal, because the number of files to be processed is too large, both of these methods are too expensive to accept.
After
This article mainly describes the Python implementation of the output program execution percentage of the method, involving Python numerical operations and system output related operation skills, the need for friends can refer to the following
The
Insert binary search and ordered list in python: application of the bisect module, pythonbisect
The python built-in module bisect implements binary search and inserts an ordered list. bisect can find out where the new element should be inserted to
I learned Python by myself. I learned strings and learned python.
I. String
(1) strings are the most common data types in Python. We can use single quotes or double quotes to create strings.
Str = 'Hello world! '
Str = "Hi Hao are you? "
(2) Python
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