I stored list of items in a single Column of Sqlite3 db(the data is taken from Qlistwidget). After inserting into Db i need to retrieve the Array into Individual items from Db and insert that items into Qlistwidget. Is there any way? Thanks in advance
test_list = []
for x in range(self.listWidget.count()):
test_list.append(self.listWidget.item(x).text())
total_names= json.dumps(test_list)
''this is the insert code''
c.execute('insert into daily_patients(patient_id,designation,name,age,years,sex,mobile,city,date,referred_by,user_name,test_names,sample_date,total_tests,notes,total_amount,payment_type,bill,discount,final_amnt)values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)',(new_id,p_designation,p_name,p_age,p_years,p_sex,p_mobile,p_city,p_date,p_referred,user_name,t_name,s_date,t_tests,p_note,t_amnt,p_type,b_amnt,p_discount,f_amnt))
'''this is the code i uses to get data from QTABLEWIDGET that is connected to Database(SQLITE3)'''
for item in rowitem_t_amount:
print(item)
self.listWidget.addItem(item)
This is the code I used to insert the QLitstwidget items into SQLITE3 db. As Json array. When I retrieve data from SQLITE3. im getting nested list of lists. I tried all types of string formatting & list Slicing but I didn't get any positive response. any help is appreciated