JSON from Python mysqldb

TYR a.harrowell at gmail.com
Wed Aug 27 09:37:56 EDT 2008


There's always the naive option.

query = ('species', 'lifestyle', 'coolness', 'tentacles=>8')
db.execute('SELECT %s, %s, %s % FROM creatures WHERE %s;' % query)
record = dict(zip((query), (db.fetchall()))
array = '''{
             '''
for k,v in record:
  array.append('"(k)":"(v)"')
array.append('''
                }''')







More information about the Python-list mailing list