Hello, I'm new to python and trying to get records from an MSAccess
database using mxODBC. It works, but the output is not formatted the
way I want it.

Here's the script:

import mx.ODBC.Windows as odbc

driv='DRIVER={Microsoft Access Driver (*.mdb)};DBQ=d:/Access
Databases/Quotations2005'

conn = odbc.DriverConnect(driv)
c = conn.cursor()
c.execute ("SELECT Author, Topic1, Topic2, Quote FROM QuotesToTxt WHERE
Author LIKE 'Mencken%'")

rows = c.fetchall()
for r in rows:
    print r

And here's what I get:

('Mencken, H.L.', 'Americans', 'Democracy', 'Democracy is the theory
that the common people know what they want, and deserve to get it good
and hard.')
('Mencken, H.L.', 'Conscience', 'Mother-In-Law', 'Conscience is a
mother-in-law whose visit never ends.  The inner voice which warns us
that someone may be looking.')

Where are the parenthese and single quotes coming from? SQL or mxODBC?
And how can I get just simple tab-delimited records with a standard
carriage return separating the records?

Thanks so much for any help.

bs

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to