0

Say I have the following two ordinary strings:


a = "A backslash (\) can mess a string up"
b = "But binaries are nice"

Say I want to convert them to raw/binary strings

raw_a = some_function(a)
binary_b = some_binary_function(b)

is that doable?

I am aware that you can declare them as such when defined in this example, but that is not the point/issue.

CutePoison
  • 4,679
  • 5
  • 28
  • 63
  • Do these prior answers help? https://stackoverflow.com/questions/17615414/how-to-convert-binary-string-to-normal-string-in-python3 https://stackoverflow.com/questions/4415259/convert-regular-python-string-to-raw-string – Random Davis Dec 14 '20 at 20:01
  • `a` is not a binary string. It is just a string. As a matter of fact, there is no such thing as a "binary string" in Python-3.x. There is a "bytes" object, and it starts with a `b`. What do you expect `raw_a` to look like? – DYZ Dec 14 '20 at 20:02

0 Answers0