Skip to content

Instantly share code, notes, and snippets.

View the8woodcutter's full-sized avatar
🍉
takin it ez ...

the8woodcutter the8woodcutter

🍉
takin it ez ...
  • CMDR of THE BATTLECRUISER
  • SOLID GOLD, CANADA
  • 19:07 (UTC -06:00)
View GitHub Profile
@durden
durden / sanitize.py
Last active April 26, 2023 11:13
Different ways to 'sanitize' a list of strings to ensure they don't contain any of the contents of another 'ignored' list
"""
Demonstration of ways to implement this API:
sanitize(unsanitized_input, ignored_words)
Related discussions:
- Modifying a list while looping over it:
- http://stackoverflow.com/questions/1207406/remove-items-from-a-list-while-iterating-in-python
- Remove all occurences of a value in a list:
- http://stackoverflow.com/questions/1157106/remove-all-occurences-of-a-value-from-a-python-list