How to iterate through the columns in a row using sqlite3.Row
Paul Rubin
no.email at nospam.invalid
Sun Mar 12 21:22:04 EDT 2017
Chris Green <cl at isbd.net> writes:
> self.conn = sqlite3.connect(dbname)
> self.conn.row_factory = sqlite3.Row
> self.cursor = self.conn.cursor()
> self.table = table
> ...
> ...
> sql = "SELECT * FROM " + self.table + " WHERE firstName||lastName = ?"
> self.cursor.execute(sql, (name,))
> row = self.cursor.fetchone()
untested:
with sqlite3.connect(dbname) as conn:
sql = "SELECT * FROM " + self.table + " WHERE firstName||lastName = ?"
cursor = conn.execute(sql, (name,))
row = cursor.fetchone()
More information about the Python-list
mailing list