Question

Jonathan Gardner jgardner at jonathangardner.net
Tue Oct 14 01:54:48 EDT 2008


On Oct 13, 9:31 pm, "Aditi Meher" <meher... at gmail.com> wrote:
>
> I am connecting database using python,and i am inserting some data into it.
> e.g.name and roll nos(some 100 records are stored)
>
> My question is "I want to display 10 records at a time and want to
> store remaining records into buffer and after displaying 10 records
> again i want to display next 10 records."
>

I have no idea what platform you are using to display the data. Is it
a GUI? A Web app? A command-line utility?

I won't give you code, but I'll give you a general description. Most
SQL-based databases allow you to write a clause for your SELECT
statement such as "LIMIT 10". You'll want to read the documentation
for the database and the connection library to figure out how best to
do this.

If you want to load all the records and only show ten, this snippet
may come in handy:

  results[10:20] # Get a list of results 10, 11, 12, 13, ..., 18, 19.
0-based, of course.

As for how to display the data, that depends on your platform.



More information about the Python-list mailing list