Python Basic Content Five

Source: Internet
Author: User

Adorner:
1, the adorner is a function, at least two layers of function.
2, for example @auth: Perform auth ah function, decorated function as parameter auth (foo)
The return value of the AUTH function, assigned to the function name of the decorated function.
3, dynamic parameters, can decorate a function containing n parameters.
4. function return value
5, Multi-decorator box model
6, three layers, three layers of how to use.
Performs a step more than the original adorner, executes the function first, gets the return value as a function, and the @ return value, even if the ordinary adorner
@w1:
1. Execute W1 function
2. Assign the return value of the W1 function to the function name of the function being decorated.


Key = kwargs[' token ']
del.kwargs[' token ']

def Filter (A1,A2):
def outer (Main_func):
def wrapper (Request,kargs):

Print A1

Main_result = Main_func (Request,kargs)

Print A2

Return Main_result

Return wrapper
return outer

@Filter (F5, F6)
def Index (Request,kargs):
print ' index '

Recursion:
Calculator
Reading consists of only +-*/and numbers, divided into three parts,
The result is stitched into a new expression to assign a value to B
Get the final result by function recursive invocation
Module:
1. Built-in module
2. Customize a block
3. Third-party modules
Modules exist in two ways:. Py "Folder"

Import Module Mode:
1. Import Sys
2. From sys import argv
Alias:
From sys import ARGV as test
Sys.path Default Path Lookup
_init_.py: Folder module must have a file, or folder module error, cannot be called.

Built-in modules:
One: OS system-related
Two: SYS interpreter-related
Third, configparser processing configuration file, special format, a section an option
Iv. Hashlib for encryption-related operation add salt operation, place crack

Python Basic Content Five

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.