M
M
Mr_Sinister2015-07-18 18:09:21
Python
Mr_Sinister, 2015-07-18 18:09:21

How to convert string from Unicode characters directly to Unicode itself (Python 3)?

If you use the literal u when declaring a variable, then everything is fine.

# coding: utf-8
s = "\u041f\u0440\u043e\u0441\u043c\u043e\u0442"

But the matter is that I receive a line from Unicode characters from the outside. You need to save a normal string to a file.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
sim3x, 2015-07-18
@sim3x

?

In [1]: s = "\u041f\u0440\u043e\u0441\u043c\u043e\u0442"

In [2]: print(str(s))
Просмот

A
Alexashenka, 2015-07-24
@Alexashenka

the string will be written normally

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question