Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Question

0 views
Skip to first unread message

Aditi Meher

unread,
Oct 13, 2008, 10:15:46 AM10/13/08
to Pytho...@python.org
Hello

How to write code to store data into buffer using python?

Please Reply

Diez B. Roggisch

unread,
Oct 13, 2008, 10:33:57 AM10/13/08
to
Aditi Meher wrote:

See here:

http://www.catb.org/~esr/faqs/smart-questions.html

Diez

Steven D'Aprano

unread,
Oct 13, 2008, 12:33:21 PM10/13/08
to

With a keyboard.

Although if you're really keen, you could use a magnetized needle and
edit the sectors on the hard disk directly.


--
Steven

Aditi Meher

unread,
Oct 13, 2008, 12:37:42 PM10/13/08
to pytho...@python.org
Hello

How to write code to store data into buffer using python?

Please reply.

Chris Rebert

unread,
Oct 13, 2008, 1:16:29 PM10/13/08
to Aditi Meher, Pytho...@python.org
To be a bit less sarcastic than the other replies, your question is
*much* *much* too vague to be answered.
Unless you give us more specific information and ask a more precise
question, it's impossible help you.
See the link someone already replied with for some good advice on how
to do that.

Also, please don't double-post like you just did, as that's bad
netiquette and just wastes everyone's time.

Cheers,
Chris
--
Follow the path of the Iguana...
http://rebertia.com

On Mon, Oct 13, 2008 at 7:15 AM, Aditi Meher <mehe...@gmail.com> wrote:
> Hello
>
> How to write code to store data into buffer using python?
>

> Please Reply
> --
> http://mail.python.org/mailman/listinfo/python-list
>

Bruno Desthuilliers

unread,
Oct 13, 2008, 11:58:17 AM10/13/08
to
Aditi Meher a écrit :

> Hello
>
> How to write code to store data into buffer using python?

A text/code editor might be useful.

Aditi Meher

unread,
Oct 14, 2008, 12:31:16 AM10/14/08
to pytho...@python.org
Hello

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."

Can you please provide me how to do this using python,what is the code for this?

Reply

Jonathan Gardner

unread,
Oct 14, 2008, 1:54:48 AM10/14/08
to
On Oct 13, 9:31 pm, "Aditi Meher" <meher...@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.

Aditi Meher

unread,
Oct 14, 2008, 2:27:37 AM10/14/08
to pytho...@python.org
---------- Forwarded message ----------
From: Aditi Meher <mehe...@gmail.com>
Date: Tue, Oct 14, 2008 at 11:55 AM
Subject: Question
To: Jonathan Gardner <jgar...@jonathangardner.net>


Hello

I am using ubuntu operating system,i am using python and self app for
DB storage.

I hv already mentioned in my question that i want to display 10
records out of 100,how to create buffer to store remaining records
which i am not displaying.

I know the logic,but my language of sytax is not good so i want actual
code please can u mail it to me.

I have created DB using self app and after that created table using
python into DB, i hv also inserted the records into it using python.

please reply.

Aditi Meher

unread,
Oct 14, 2008, 2:33:10 AM10/14/08
to pytho...@python.org

Ben Finney

unread,
Oct 14, 2008, 3:28:27 AM10/14/08
to
"Aditi Meher" <mehe...@gmail.com> writes:

> I know the logic,but my language of sytax is not good

There's no fault in not knowing the language, unless you choose not to
rectify that by learning. If, on the other hand, you want to have
programs without learning how to program in the language, you've come
to the wrong place.

> so i want actual code please can u mail it to me.

What price and terms are you offering for the service of someone
writing your code for you?

Alternatively, if you want actual code, please *learn* from the
well-written tutorials and then *write some* yourself, present it
here, and we can discuss it in public for the benefit of all.

--
\ “Yesterday I told a chicken to cross the road. It said, ‘What |
`\ for?’” —Steven Wright |
_o__) |
Ben Finney

Gabriel Genellina

unread,
Oct 14, 2008, 3:02:10 PM10/14/08
to pytho...@python.org
En Tue, 14 Oct 2008 03:27:37 -0300, Aditi Meher <mehe...@gmail.com>
escribió:

> I am using ubuntu operating system,i am using python and self app for
> DB storage.
>
> I hv already mentioned in my question that i want to display 10
> records out of 100,how to create buffer to store remaining records
> which i am not displaying.
>

> I know the logic,but my language of sytax is not good so i want actual


> code please can u mail it to me.
>

> I have created DB using self app and after that created table using
> python into DB, i hv also inserted the records into it using python.

Maybe you're making things more complicated that they should be.
You don't have to create a "buffer" to store records. If you only want to
move forward (that is, you don't have to show previous records) just keep
the cursor, and use cursor.fetchmany(10) to fetch the next 10 rows to show.
If you have to move back and forth, just use cursor.fetchall and store the
result (this is your "buffer", a list of records).
For 100 records that's all you need. If you expect it to grow to 100000
records, or have many users concurrently updating the database, this might
not be the right answer.

--
Gabriel Genellina

David C. Ullrich

unread,
Oct 14, 2008, 3:13:19 PM10/14/08
to
In article <mailman.2401.1223915...@python.org>,
"Aditi Meher" <mehe...@gmail.com> wrote:

> Hello
>
> How to write code to store data into buffer using python?

buffer = data

> Please reply.

--
David C. Ullrich

Lawrence D'Oliveiro

unread,
Oct 14, 2008, 8:16:43 PM10/14/08
to
In message <mailman.2401.1223915...@python.org>, Aditi
Meher wrote:

> How to write code to store data into buffer using python?

Write following code:

buffer = data

0 new messages