10/6/2023 0 Comments Json to sqlite python![]() My json file is like this (containing traffic data from some crossroads in my city). My intention is to decide later which data container and entry point is best, json (data entry via text editor) or SQLite (data entry via spreadsheet-like GUIs like SQLiteStudio). ![]() The only diffence between the json.load() and json.loads() funciton is that json.load() funtion convert the json file data into a string and json.loads() funciotn convert the json file data into python dictionay object.I want to convert a JSON file I created to a SQLite database. What is the difference between json.load() and json.loads() functions import sqlite3Ĭonnection = nnect('database.db')Īfter the execution of this line, a file with the name of database.db is created in the current working directory. If the database file is not available in that path, It will automatically create a new database file. The path should be provided as a parameter to this function to make a connection. the parameter it takes is the path to the SQLite database. To make a connection to the database and make it active we use the nnect() function. Traffic = json.load(open('json_file.json'))Ĭursor.execute('insert into Student values(?,?,?)',keys)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |