python decorater working priciple
来源:互联网 发布:如何应对网络谣言 编辑:程序博客网 时间:2024/05/01 09:11
from flask import Flask
@app = Flask('/')
def hello():
return'hello word!'
#I will tell you how to understand the decorater @app = Flask('/') and it's working priciple:
#for axample of a decorater:
def my_decorater(f):
def wrapper():
print "starting : my name is xxx"
f()
print"ending : xxx is my name"
def hello ():
print "hello world"
hello()
#'''the output is "starting : my name is xxx
hello world
ending : xxx is my name" '''
@app = Flask('/')
def hello():
return'hello word!'
#I will tell you how to understand the decorater @app = Flask('/') and it's working priciple:
#for axample of a decorater:
def my_decorater(f):
def wrapper():
print "starting : my name is xxx"
f()
print"ending : xxx is my name"
return wrapper
def hello ():
print "hello world"
hello()
#'''the output is "starting : my name is xxx
hello world
ending : xxx is my name" '''
阅读全文
0 0
- python decorater working priciple
- Python 装饰器decorater
- Priciple of Least Knowledge
- 装饰器(Decorater)
- python source/working/home directory
- Working with Generators of Python
- Python Basics: Working with Strings
- java装饰者模式decorater
- working....
- Working
- working
- Working with Excel Files in Python
- php exec python script not working [Solved]
- Interface Segregation Priciple接口隔离原则
- Composite和Decorater模式联系和区别
- how to get cwd(current working directory) in python?
- 1: Command Line Python(Challenge: Working with the Command Line)
- A software design priciple from 'Exceptional C++' of Herb sutter
- AndroidScrollView滑动到顶在向下话会出现颜色块
- 关于前端微信分享jssdk config:invalid signature 签名错误
- easyUI入门--3
- 一对一直播技术服务【推广】
- angular路由
- python decorater working priciple
- RN 环境搭建
- 欢迎使用CSDN-markdown编辑器
- 史上最简单的 MySQL 教程(二十六)「连接查询(上)」
- js中constructor和prototype的正确理解
- easyui多行复杂表头数据显示
- HDU6156 Palindrome Function(回文数)
- 指针常量 常量指针
- NDK学习笔记<七> 使用AndroidStudio本身,编译C/C++文件生成SO文件