munge.py

Tue, 02 Feb 2016 20:47:47 +0200

author
Teemu Piippo <crimsondusk64@gmail.com>
date
Tue, 02 Feb 2016 20:47:47 +0200
changeset 167
032c90f1727b
parent 162
d24fe5e3e420
permissions
-rw-r--r--

Stuff

#!/usr/bin/env python3
# encoding: utf-8
'''
Provides the munge function.
'''

import string
mungechars = 'аɓᴄđеƒɡɦіјķɭṁɳорqŗѕƫᴜᴠᴡхуᴢАВСḌЕḞǴНІЈКLМΝОРQɌЅТÙⅤⱲХΥΖ'
mungedict = dict (zip (string.ascii_lowercase + string.ascii_uppercase, mungechars))

def mungeone (ch):
	'''
	Munges one character.
	'''
	try:
		return mungedict[ch]
	except:
		return ch

def munge (a):
	'''
	Munges the given string
	'''
	return ''.join (mungeone(ch) for ch in a)

mercurial