获得查询结果表的列名:
- db = sqlite.connect('data.db')
- cur = db.cursor()
- cur.execute("select * from table")
- col_name_list = [tuple[0] for tuple in cur.description]
- print col_name_list
获得所有列名:
- cur.execute("PRAGMA table_info(table)")
- print cur.fetchall()