Skip to content

Instantly share code, notes, and snippets.

@mgnisia
Created February 13, 2020 13:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mgnisia/8c7f8f7333983a994b971bb10c31ad77 to your computer and use it in GitHub Desktop.
Save mgnisia/8c7f8f7333983a994b971bb10c31ad77 to your computer and use it in GitHub Desktop.
Remove files that contain a certain string in a value
from tinydb import TinyDB, Query
db = TinyDB("path/to/your.db.json")
q = Query()
# the items that should be remove have stringXYZ in field name
db.remove(q.name.search('stringXYZ'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment