Feb-08-2020, 08:17 PM
but with prettytable librairy I save the text file with correct positioning of the columns
with this code :
with this code :
from prettytable import from_db_cursor def create_file_from_database(self): conn = sqlite3.connect ('database.db') curseur=conn.cursor() c=curseur.execute("SELECT * FROM table") mytable = from_db_cursor(c) table_txt = mytable.get_string() with open("textFile.txt", "w",encoding="utf-8") as file_loc35R: file_loc35R.write(table_txt) conn.commit() curseur.close() conn.close()ther is the picture of text file with nice display