备注一下省的忘了
大致有三种方法
假设现在有一个数据库test0,库里有一个表t1,表里有一个列f1
cursor.execute("PRAGMA table_info(t1)")
name = cursor.fetchall()
print name
# [(0, u'f1', u'integer', 0, None, 0)]
cursor.execute("SELECT sql FROM sqlite_master WHERE tbl_name = 't1' and type = 'table'")
name = cursor.fetchall()
print name
# [(u'CREATE TABLE t1(f1 integer)',)]
cursor.execute("SELECT * FROM t1")
col_name_list = [tuple[0] for tuple in cursor.description]
print col_name_list
# ['f1']