If this was PHP, I would probably do something like this:
function no_more_half_widths($string){ $foo = array(\'1\',\'2\',\'3\',\'4\',\'5\',\'6\',\'7\',\'8
Using the unicode.translate method:
unicode.translate
>>> table = dict(zip(map(ord,u'0123456789'),map(ord,u'0123456789'))) >>> print u'123'.translate(table) 123
It requires a mapping of code points as numbers, not characters. Also, using u'unicode literals' leaves the values unencoded.
u'unicode literals'