I\'d like to convert some character into five digit unicode on in Python 3.3. For example,
import re print(re.sub(\'a\', u\'\\u1D15D\', \'abc\' ))
Python unicode escapes either are 4 hex digits (\uabcd) or 8 (\Uabcdabcd); for a codepoint beyond U+FFFF you need to use the latter (a capital U), make sure to left-fill with enough zeros:
>>> '\U0001D15D' '