0

Hey i have here my code:

elif command == 'del' or command == 'delete':
    Cat_Del = input('Which Category do you wanna delete: ')
    Name_Del = input('Whats the name ')
    Category = Query()
    Name = Query()
    Every_Del = db.search(Category['Category'] == '%s' % Cat_Del
                    and Name['Naam'] == '%s' % Name_Del)

    print(db.all())

and here my database:

   {"_default": {"1": {"Category": "Fruit", "SubCategory": "zoet", "Naam": 
   "appel", "Cost": "$5"}, "2": {"Category": "Fruit", "SubCategory": "zoet", 
   "Naam": "banaantje", "Cost": "$10"}}}

and i wanna know how to delete 'something' from the Delete commando: elif command == 'del' or command == 'delete' for example i want to know how to delete only apple out of my database so im gonna run the script and im answering the questions with q1 = Fruit, q2 = appel but how to delete it then?

Vishal Taj PM
  • 1,339
  • 11
  • 23
  • Possible duplicate of [How to delete record or document from TinyDB](https://stackoverflow.com/questions/31022581/how-to-delete-record-or-document-from-tinydb) – ramazan polat Mar 23 '18 at 17:04

1 Answers1

0

this was the solution to the problem but thank you all for viewing this; if you have something better feel free to post it!

db.remove(Category['Category'] == '%s' % Cat_Del and Name['Naam'] == '%s' % Name_Del)