I'm curled up in a part of the code I'm doing. I need to retrieve only the first 10 records of an object that I call in a for loop:
listaTabela = []
for aluno in alunos:
listaLinha = ""
listaLinha += str(aluno.getRA())
listaLinha += ";"
listaLinha += str(aluno.getNome())
listaTabela.append(listaLinha)
The way it is, it makes the loop is usually as long as there are records in 'students'. Would there be a way to limit this loop so that it runs only in the first 10 records? I tried using while but he repeated the same record 10 times.