So, I have a database called cars.db that has a table == inventory,
Inventory essentially contains
('Ford', 'Hiluz', 2), ('Ford', 'Tek', 6), ('Ford', 'Outlander', 9), ('Honda', 'Dualis', 3), ('Honday', 'Elantre', 4)
Then I wrote this, which is intended for editing this in csv, however I canβt process it, in some cases I get print material, but it is wrong, and when I try to fix it, it doesnβt print anything. Any suggestions to get me tracking?
#write table to csv import sqlite3 import csv with sqlite3.connect("cars.db") as connection: csvWriter = csv.writer(open("output.csv", "w")) c = connection.cursor() rows = c.fetchall() for x in rows: csvWriter.writerows(x)
source share