database

Michael Hudson mwh21 at cam.ac.uk
Sun Jul 11 08:09:26 EDT 1999


"dzsi" <granadam at mail.datanet.hu> writes:

> hi,
> 
> i am new to python.......
> 
> i have a database (comma separated text), and i would like to get some data
> out of it based on some query. let's say there are seven fields, f1...f7,
> and i am searching for entries in f1, and want to display f1..f7  for the
> field that matches the query. how do i go about doing that?

Well, I'd use awk, myself. However there have been numerous threads
about parsing csv databases in the recent past. http://www.deja.com is
your friend...

If you don't have to worry about commas or newlines in fields, then
this is a simple as using <file object>.readline and string.split.

> also, can i access db databases, or any other common pc type databases with
> perl scripts only on a unix system? without any server configuration,
> assuming python is installed. so far, the comma separated text file is the
> only way i could figure out.

I'm no expert, but I'd say provisionally yes, depending on details.

> thanks,
> 
> adam.


HTH
Michael




More information about the Python-list mailing list