Joaquin Alzola wrote:
> Hi People
>
> I need to covert this string:
>
> hello there
> this is a test
>
> (also \n important)
>
> To this Unicode:
>
00680065006c006c006f0020002000740068006500720065000a00740068006900730020006900730020006100200074006500730074000a
> Without the \u and space.
>
> https://www.branah.com/unicode-converter
>
> I seem not to be able to do that conversion.
>
> Help to guide me will be appreciated.
>>> import codecs
>>> s = u"hello there\nthis is a test\n"
>>> codecs.encode(s.encode("utf-16-be"), "hex")
'00680065006c006c006f0020002000740068006500720065000a00740068006900730020006900730020006100200074006500730074000a'
--
https://mail.python.org/mailman/listinfo/python-list