Python Notes for Files & Exceptions
Python Notes for Files & Exceptions
1. Read data from files
1.1 Read the entire file
1.2 File Path
1.3 read line by line
1.4 Create a list of all lines of a file
1.5 Contents of User Files
1.6 Processing large files
2 Write to file
2.1 Write empty files
2.2 W ...
Posted by ebgames56 on Wed, 08 May 2019 22:54:03 +0200
1. Decorated functions have multiple parameters.
2. Decorated functions have return values
3. Embedding decorators in functions
As you already know from the previous article, if you still don't under ...
Posted by bdeonline on Wed, 08 May 2019 21:45:02 +0200
These days, my friends say they want to read e-books, but they can only read them on the Internet, but they can't download them to the local area. What can I do? I looked at several novel websites. You can only read them directly on the Internet. To download txt, you have to buy members for money, and you can't copy and paste them directly on t ...
Posted by ironman on Wed, 08 May 2019 19:27:03 +0200
conda was used as a virtual environment management tool during development, but sometimes it is temporary and necessary.If you use conda create to create a new environment, it takes a lot of time, sometimes forgot to delete it, and finally a bunch of virtual environments in the system.After accidentally discovering pipenv, try it out and feel t ...
Posted by illushinz on Wed, 08 May 2019 17:36:02 +0200
Common methods: Lists, tuples, dictionaries and strings can be used together.
Python built-in functions
Listing of built-in functions
Calculate the number of elements in the container
del has two methods
Returns the maximum value of the element in the container
Posted by flashbot on Wed, 08 May 2019 11:30:03 +0200
Function Compute is an event-driven service. Through function computing, users do not need to manage the operation of servers, but only write code and upload it. Function computing prepares computing resources and runs user code in a flexible and scalable manner, while users only need to pay for the resources consumed by running the act ...
Posted by blui on Wed, 08 May 2019 01:50:03 +0200
Article firstCreative Patterns: Factory Approach
Name: Factory Method
English name: Factory method Pattern
Values: Expansion is my monopoly
Define an interface for creating an object, but let subclasses decide which class to instantiate. Factory Methods lets a class defer instantiation to subclasses. ...
Posted by FFEMTcJ on Tue, 07 May 2019 18:45:04 +0200
Array method collation
all(), any(), none() and one() Testing whether all or part of the elements in an array satisfy a given condition. Conditions can be determined in a block of statements or parameters.
append() Equivalent to push()
bsearch() Dichotomy Finding Elements
bsearch_index() Dichotomy Finds Elements and Returns ...
Posted by ricoche on Tue, 07 May 2019 13:35:03 +0200
Class and instance
Classes are abstract templates, and instances are concrete "objects" created according to classes.
Class: A collection of objects that describe the same properties and methods. It defines the properties and methods common to each object in the set. Objects are instances of ...
Posted by kevgais on Tue, 07 May 2019 10:40:04 +0200
We always use redis of Aliyun. We are not a high concurrent application. We mainly use redis as distributed locks and a small amount of caches. It hardly needs maintenance. Yesterday afternoon, we suddenly received an alarm email. On-line redis memory is used 100% and instantaneous nerve tension sensation is confirmed by console.This is a ...
Posted by jim_de_bo on Mon, 06 May 2019 15:00:04 +0200