我正在尝试使用flask添加2个列表,但是它不起作用。这是我的代码:
sum2no.py
import sumlist
from flask import Flask
from flask_restful import Resource, Api
app = Flask(__name__)
api = Api(app)
class Sumnumbers(Resource):
def get(self, num1, num2):
self.num1=[]
self.num2=[]
return [sumlist.sumtwo(num1,num2)]
api.add_resource(Sumnumbers, '/s/[<num1>]/[<num2>]')
if __name__ == '__main__':
app.run()
sumlist.py
def sumtwo (a,b):
c = int(a[0]) + int(b[0])
return c