Skip to content

Instantly share code, notes, and snippets.

@ztane
Created May 16, 2020 20:56
Show Gist options
  • Save ztane/db12bf62982dcc40946c80a10f6ddcf9 to your computer and use it in GitHub Desktop.
Save ztane/db12bf62982dcc40946c80a10f6ddcf9 to your computer and use it in GitHub Desktop.
Yadayada gettext
import re
import itertools
def ugettext(s):
c = itertools.cycle('yada')
def replace(m):
char = m.group(0)
replacement = next(c)
if char.isupper():
return replacement.upper()
return replacement
return re.sub('[a-zA-Z]', replace, s)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment