Mode
Description
R
Read-only
r+
Write
W
Write, delete the original file before re-writing, if the file is not created
w+
Read and write, first delete the original file,
1. Local thread, ensuring that even multiple threads, their values are isolated from each other. 2. General Object PresentationImport Threadingimport timeclass A (): passA =A ()def func (num): a.name=num time.sleep (1) Print
1, strip, Rstrip, Lstrip1 name=' a b \ n'2print# default minus the left space and line break 3print(Name.rstrip ())# default minus the right space and line break 4Print (Name.lstrip ())# default to remove both spaces and line breaksReturnA b C 2.
Python Regular expression Knowledge pointsRegular common symbols. : matches any character, except line breaks*: Matches the previous character 0 or unlimited times? : matches the previous character 0 or 1 times. *: Greedy algorithm.*? : Non-greedy
Basic functions to complete: Add business Card Delete business card Modify business Card Query business card exit systemIdea: Use a dictionary as a business card to store personal information, and then put the business card into the list.Cardlist = [
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.
ReflectionTo manipulate (Find/check/delete/set) a member (function) in the form of a string into an object (module), reflectingImplemented with a GET method of a copy pagecommons.py fileCommons.pydef login (): print ("Login page") def logout ():
Scenario: Request Verification code Module regvc.py read the configuration file Config.ini, the regvc.py module executes normally, but the run_all.py module executes the Times error in bulk, the section is not foundWorkaround: The configuration file
A dictionary is another mutable container model and can store any type of object.The value is convenient and the speed is fast.1. Check2. Increase3. Change4. Delete# DeleteDic.pop (' sex ') #删除某个keyDic.popitem () #随机删除一个Dic.clear () #清空字典D =
Built-in functionsList listsTuple tuplesData type: int boolData structure: Dict list tuple set strReversed () reversalKeep the original list to generate a reverse iteratorSlice () can generate a slice rule, infinitely applyFormat () to set the
Basic concepts, especially objects and classes, are described in the basic tutorials.The advanced tutorial further expands on the basic tutorials to illustrate Python details. Hopefully, after the advanced tutorial, you have a more comprehensive
Because to make a point of view, the House of opinion is similar to the topic of knowledge, so we have to find a way to climb down to get him down, after a long while finally finished, the code is written in Python, do not know the trouble
Job 1: Combining nestingLike the following list, each function is implemented as requiredlist = [[' K ', [' qwe ', 20,{' K1 ': [' TT ', 3, ' 1 ']},89], ' AB ']Turn TT into uppercase, in two waysConverts the number 3 to the string ' 100 ',
Exchange-fanout broadcast mode,I. Preface
We can see that the producer delivers the message to the Queue. In fact, this will never happen in RabbitMQ. Actually, the producer sends messages to Exchange (X in the switch), and Exchange routes messages
The python decorator monitors abnormal codes and decorations python.
Exceptions do not exist, but we sometimes encounter such a situation. For example, when we monitor the server and collect information every second, we do not collect the
Python programming pygame module implements the mobile car sample code, pythonpygame
Pygame is a cross-platform Python module designed for video games, including images and sounds. Based on SDL, real-time e-game R & D is allowed without being bound
Python uses Pygame to draw the mobile rectangular instance code, pythonpygame
Pygame is a module mostly used for game development.
The example in this article is mainly to implement a mobile rectangular instance code in the demo box. The complete
Linux encoding and encoding conversion, linux encoding conversion
If you need to operate files in windows in Linux, you may frequently encounter file encoding conversion problems. In Windows, the default file format is GBK (gb2312), while Linux is
Python practice = build an FTP service with python code, and use pythonftp
Environment setup:
Python
Windows/linux
Pip install pyftpdlib (Installation failed Please download here: https://pypi.python.org/pypi/pyftpdlib)
One line of code:
Run it
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