473,323 Members | 1,550 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,323 software developers and data experts.

hi,everyone. a problem with shelve Module

according to the book instruduction , i use shelve Module to write
record to file.

i only write ten records like this:

name sex age

jim male 22
tom male 23
lucy female 21

.................................................. others( about ten
records)

but i find the size of this file .oh my god , it is about 24k

the file is too large ! is it normal ?

i don't dare to think that if i has 1000 records , it will be a very
large file!

May 26 '06 #1
4 1038
i only write ten records like this: name sex age jim male 22
tom male 23
lucy female 21 ...
but i find the size of this file .oh my god , it is about 24k the file is too large ! is it normal ?


Yes. It's the nature of packages like Berkeley DB, gdbm and dbm (the
packages mediate access to the database file under the covers) that they
trade space for time. The files they create are not simple text files.
They are organized to permit quick access to records by key and to permit
average time fast insertion.

Skip
May 26 '06 #2
sk**@pobox.com i'rta:
>> i only write ten records like this: >> name sex age >> jim male 22
>> tom male 23
>> lucy female 21 ...
>> but i find the size of this file .oh my god , it is about 24k >> the file is too large ! is it normal ?

Yes. It's the nature of packages like Berkeley DB, gdbm and dbm (the
packages mediate access to the database file under the covers) that they
trade space for time.

Sometimes you add records but the size of the database does not
change... :-) The files they create are not simple text files.
They are organized to permit quick access to records by key and to permit
average time fast insertion.

Skip


May 26 '06 #3
really

in which case?

May 26 '06 #4
In article <11**********************@u72g2000cwu.googlegroups .com>,
softwindow <so********@gmail.com> wrote:
[some context restored]
Sometimes you add records but the size of the database does not
change... :-)

really

in which case?


whenever the database is big enough to add them without it's having to
grow :)


--
Jim Segrave (je*@jes-2.demon.nl)

May 26 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Rami A. Kishek | last post by:
Hi - this mysterious behavior with shelve is just about to kill me. I hope someone here can shed some light. First of all, I have this piece of code which uses shelve to save instances of some...
1
by: Stuart Hungerford | last post by:
Hi all, I have a python module foo.py which contains: class A(object): ... class B(object): ... As well as a class that uses shelve (which in turn is using dumbdbm):
0
by: Michael Mulcahy | last post by:
Hi All, Problem: Shelve module doesn't like me OS: Win2000 version: 2.3.3 Here is simple reproduction code and the error that occurs: import shelve, anydbm
0
by: Riko Wichmann | last post by:
Dear all, I have Pyhthon 2.3.4 compiled from sources installed. I would like to create a data base which is accessed by a key using the shelve module. However, if I try to open a...
1
by: josegomez | last post by:
Hi! I want to use shelve to store lists which are indexed by an integer key. The keys are not concurrent or anything, they are just defined as integer values. However, shelve complains that I...
13
by: 7stud | last post by:
test1.py: -------------------- import shelve s = shelve.open("/Users/me/2testing/dir1/aaa.txt") s = "red" s.close() --------output:------ $ python test1.py
0
by: Douglas Applegate | last post by:
Hi- I am having a problem with shelve. The problem I think is really with gdbm. I'll write out a file using shelve/gdbm on an amd64 machine and then I'll try to read it in on a i386 machine. The...
0
by: Gabriel Genellina | last post by:
En Mon, 28 Apr 2008 02:08:31 -0300, tarun <tarundevnani@gmail.comescribió: By default, each time you do d you get a *different* object. A shelve isn't very smart: it stores a string...
1
by: bluesmanu | last post by:
Hi all, I am trying to use the shelve module to save an object of a 'Electron' class I made into a file. The writing goes well but the reading goes : Traceback (most recent call last): File...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.