There are two ways you can achieve it.
1.
cursor.execute("PRAGMA table_info(tablename)")
print cursor.fetchall()
2.
sql = sqlite3.connect(self.cFile)
c = sql.cursor()
query = "select * from preferences"
c.execute(query)
col = [tuple[0] for tuple in c.description]
print col
Note:
cur.description returns a tuple of information about each table. The entire tuple is : (name, type_code, display_size, internal_size, precision, scale, null_ok)
No comments:
Post a Comment