Delete data¶
Delete all books in a specific language:
4def delete_by_language(language): 5 conn = sqlite3.connect("library.db") 6 cursor = conn.cursor() 7 8 sql = f""" 9 DELETE FROM books 10 WHERE language = '{language}' 11 """ 12 cursor.execute(sql) 13 conn.commit()
Call the method with the parameter of the language to be deleted:
16delete_by_language(language="de")