简体   繁体   English

如何在Python的字符串中添加@,/,\\,*之类的字符,而不将其读取为转义序列

[英]How do I add characters like @, /, \, * in a string in Python, without it reading it as an escape sequence

I am trying to send a message on twilio. 我正在尝试在twilio上发送消息。 The message includes an ASCII artwork that I have made. 该消息包括我制作的ASCII图稿。 It contains characters like *, /, \\, " and #. When I add my drawing in a python string, it reads it as an escape sequence, giving me a bunch of unintended errors. How do I reformat my code so that python prints anything that is within the strings as is, without trying to edit it as an escape sequence. 它包含*,/,\\,“和#之类的字符。当我将图形添加到python字符串中时,它将其作为转义序列读取,给了我很多意外错误。如何重新格式化代码,以便python打印字符串中的所有内容均保持原样,而无需尝试将其作为转义序列进行编辑。

message = client.messages.create(
                     body= """                  


      .---------. | == |
      |.-"""""-.| |----|
      ||       || | == |
      ||       || |----|
      |'-.....-'| |::::|
      `"")---(""` |___.|
     /:::::::::::\" _  "
    /:::=======:::\`\`\
jgs `"""""""""""""`  '-'


                     """

s="\\\\" is a single backslash. s="\\\\"是单个反斜杠。 You escape escaping. 您逃脱了。

When copy-pasting, use replace command in your editor (Ctrl+H) 复制粘贴时,请在编辑器中使用replace命令(Ctrl + H)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM