[Tutor] Making a database

Alan Gauld alan.gauld at blueyonder.co.uk
Fri Apr 16 18:20:29 EDT 2004


> I want to make, to become better in programming, a simple Database.
> This Database can save texts, titles and dates. If it saves a text
(with
> title and date) it can be read again and it will be saved into a
.txt file.
>
> Are there any tutorials on Internet which explain some more about
databases
> and how to make them?

The easiest way to do this in Python is use the shelve module
- which looks a lot like a dictionary - to store the data in a file.

Or you can go for a full blown SQL database (several freebies on
the web) and use Pythons DBI modules to access it. But you need
to learn SQL first to do that!

Alternatively you can take the hard road and just write some
custom code to write your data to a file and another function
to read it back. Maybe another function to search for a single
record etc... All good experience but ultimately unlikely to
be any better than the pre-written modules mebntioned above.

I'd go with shelve!

Alan G
Author of the Learn to Program web tutor
http://www.freenetpages.co.uk/hp/alan.gauld




More information about the Tutor mailing list