D
D
D55RUS2020-04-25 10:49:36
Python
D55RUS, 2020-04-25 10:49:36

How to convert b' ' to a regular string in Python?

5ea3eb522b11a978691735.png
I need to get a regular string like 'text' from b' ' format. How to do it?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Eugene Pedya, 2020-04-25
@D55RUS

Decode from byte string to utf-8

b = b''
b.decode('utf-8')

But first understand what encoding you need and set the locale, if not win

1
15432, 2020-04-25
@15432

py3_string_bytes.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question