获得查询结果表的列名:
- 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()
2023-08-21 15:01:22
获得查询结果表的列名:
获得所有列名:
下一篇:MongoDB源码编译