Escape for str in Python

前端 未结 6 1459
星月不相逢
星月不相逢 2021-01-25 02:45

Wow, this should be so simple, but it\' just not working. I need to inset a \"\\\" into a string (for a Bash command), but escaping just doesn\'t work.

>>&         


        
6条回答
  •  一个人的身影
    2021-01-25 03:08

    The second example is correct. There are two slashes because you are printing the Python representation of the string.

    If you want to see the actual string, call print a.

提交回复
热议问题