stmt.store_result() print("Table: sample") if stmt.num_rows > 0: name = [] id = [] print("+----+--------------------+") print("| ID | Name |") print("+----+--------------------+") for i in range(0, stmt.num_rows): stmt.bind_result(id, name) stmt.fetch() print("| {:2} | {:18} |".format(id[0], name[0])) print("+----+--------------------+") stmt.close() print("Closing the Database connection...") sqlite.close() print("Connection closed.") print("Program ends at:", datetime.now()) print("Execution time:", datetime.now() - began) """ Output: Program starts at: 2015-10-22 15:17:34.523776 Connecting to Database... ... Connected to Database. Creating a table... ... Table created. Inserting some values... ... 4 rows added. Last inserted id: 4