每当我输入像 “Muhammed 去商店说“请给我一些泡菜”
这样的字符串时,它似乎搞砸了字符串的处理方式,因为 我可以吗?请吃些泡菜
变得无效。所以我认为在它的两边添加“””肯定会解决它,如果有更好的解决方案,我愿意接受。
最佳答案
你可以转义内引号:
"Muhammed went to the store and said \"Can I have some pickles please\""
或者使用单引号
'Muhammed went to the store and said "Can I have some pickles please"'
关于python - 在字符串的开头和结尾添加 """?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7139361/