[Python] Trouble with return in loop plotting real time data using Flask [closed]

Discussão em 'Python' iniciado por Stack, Julho 2, 2025.

  1. Stack

    Stack Membro Participativo

    I have problem when use value from list in this code. Return syntax breaks the loop and I can use all the data from the list. This is my code:

    @app.route('/data', methods=["GET", "POST"])
    def data():
    value1 = [1, 2, 3, 4, 5, 6]
    for i in range(0,len(value1)):
    data = [time() * 1000, value1]
    response = make_response(json.dumps(data))
    response.content_type = 'application/json'
    return response

    Continue reading...

Compartilhe esta Página