flask向前台返回json数据和后台生成uuid

一.返回给前台json数据

引入from flask import Flask, request, jsonify, json, render_template

1.jsonify转换为json 

test = jsonify({"test": "11"})

2.dumps转换为json 

test = json.dumps({"yyy": "11111111111"})

二.Python生成UUID

import uuid

print(uuid.uuid4())

更多信息:https://tmspace.cn

你可能感兴趣的:(flask向前台返回json数据和后台生成uuid)