Is it possible to convert a string to unicode characters in Python?
For example: Hello => \u0048\u0045\u004C\u004C\u004F
You can't. A string already consists of 'Unicode characters'. What you want to change is not its representation but its actual contents.
That, fortunately, is as simple as
import re text = 'Hello' print (re.sub('.', lambda x: r'\u%04X' % ord(x.group()), text)) which outputs
\u0048\u0065\u006C\u006C\u006F print(''.join(r'\u{:04X}'.format(ord(char)) for char in 'Hello'))