[Python] Loop through Mysql Results

Discussão em 'Python' iniciado por Stack, Abril 5, 2025.

  1. Stack

    Stack Membro Participativo

    This is the code I have:

    r = ''
    while True:
    data = result.fetch_row()
    r+= record[0][0] + record[0][1] + record[0][0]
    print r


    What I want to do is, first fetch all the rows:

    data = result.fetch_row(0)


    and then run a loop for "data"

    rather than do it within the while loop.

    Continue reading...

Compartilhe esta Página