0

I want the output value to change like this. [['a'], ['b'], ['c']]-------->['a', 'b', 'c']

What should I do?

import os
from flask import Flask, jsonify
import sqlite3
import json

app = Flask(__name__)
DB = os.path.join(os.path.dirname(__file__), 'db.db')

@app.route('/all')
def get_fruits():
    
    import sqlite3
    
    conn = sqlite3.connect(DB)
    cursor = conn.cursor()
    cursor.execute('SELECT name FROM Part2_table ORDER BY name ')
    
    answer_2 = cursor.fetchall()
    return jsonify(answer_2)

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

0 Answers0