>>> re.sub('\w', '\1', 'абвгдеёжз')
'\x01\x01\x01\x01\x01\x01\x01\x01\x01'
Why does re.sub return data in this format? I want it to return the unaltered string 'абвгдеёжз'
in this case. Changing the string to u'абвгдеёжз'
or passing flags=re.U
doesn't do anything.