A
A
AlmazKayum2018-02-15 22:13:48
Python
AlmazKayum, 2018-02-15 22:13:48

Byte literal b'string_text' in Python 3?

Good time!
There is a string str1 = 'string_text' You
need to get the string str2 = b'string_text',
by str2 =b'str1'
But it will also not be right ...
How to do it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2018-02-15
@AlmazKayum

str2 = str1.encode()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question