Skip to content

Instantly share code, notes, and snippets.

@jaseg
Created July 14, 2015 19:53
Show Gist options
  • Save jaseg/00b067663ccf1ced8855 to your computer and use it in GitHub Desktop.
Save jaseg/00b067663ccf1ced8855 to your computer and use it in GitHub Desktop.
censor.py
import re
censor = lambda s: re.sub('[acemnopqrsuvwxyz]', '▄', re.sub('[bdfhijkltABCDEFGHIJKLMNOPQRSTUVWXYZ]', '█', s))
# censor('This is a test.') → '███▄ █▄ ▄ █▄▄█.'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment