配置文件预览
DEFAULT_CONVERTERS = {
'default': UnicodeConverter,
'string': UnicodeConverter,
'any': AnyConverter,
'path': PathConverter,
'int': IntegerConverter,
'float': FloatConverter,
'uuid': UUIDConverter,
}
具体使用方式
from flask import Flask, jsonify
app = Flask(__name__)
app.debug = True
@app.route('/<name>') # 默认
@app.route('/<string:name>') # 字符串
@app.route('/<int:name>') # 数字
@app.route('/<path:name>') # 路由,带 /
def index(name):
return 'hello' + str(name)
if __name__ == '__main__':
app.run()
标签:__,name,Flask,app,UnicodeConverter,转换器,route
From: https://www.cnblogs.com/wellplayed/p/18044364