How to return a list with Flask
<p>I'm trying to build a web page with questions and answers of a survey stored in my database. I get from my database the questions and answers in two separate lists and I'd like to return them (combining them each other) but I received this error "list object is not callable". The code is:</p>

<pre><code>@app.route('/show/&lt;quest&gt;')
def show(quest):

    q_id = g.db.execute("SELECT id_survey FROM surveys WHERE survey=?",[quest]).fetchone()[0]

    a = g.db.execute("SELECT q_id,a_id FROM mesh WHERE s_id=? ORDER BY q_id",[q_id]).fetchall()

    questions=list()
    answers=list()

    for i in a:
        b = g.db.execute("SELECT question FROM questions WHERE id_questions=?",[i[0]]).fetchone()[0]
        c = g.db.execute("SELECT answer FROM answers WHERE id_aswers=?",[i[1]]).fetchone()[0]

        domande.append(b)
        risposte.append(c)

    return domande + answers
</code></pre>

<p>the desirable outcome should be:</p>

<p>Title of survey</p>

<p>question 1: answers</p>

<p>question 2: answers</p>

<p>...</p>

<p>and so on</p>

<p>P.S.: For example the 2 lists questions and answers are like this:</p>

<p>questions=[u'favourite color?',u'favourite color?',u'favourite color?',u'do you like pasta?',u'do you like pasta?']</p>

<p>answers=[u'red',u'green',u'blue',u'yes',u'no']</p>

<p>They always have the same length. Thank you in advance.</p>