将参数传递给printf

时间:2017-11-29 04:15:23

标签: c

from flask import Flask
from flask_restful import Resource, Api
from sqlalchemy import create_engine
import json

app = Flask(__name__)
api = Api(app)

class DPM:
    def __init__(self, time, month):
       self.time = time
       self.month = month
energy = DPM('[12.18]','11')

def jdefault(o):
    return o.__dict__
print(json.dumps(energy, default=jdefault, indent=4))

api.add_resource(DPM, '/DPM')

if __name__ == '__main__':
    app.run(debug=True)

上述程序的输出是24 24 24.有人可以解释一下吗?

0 个答案:

没有答案