在 PHP 中,将解析用“双引号”括起来的字符串以查找要替换的变量,而用“单引号”括起来的字符串则不会。在 Python 中,这是否也适用?
最佳答案
No :
2.4.1. String and Bytes literals
...In plain English: Both types of literals can be enclosed in matching single quotes (
'
) or double quotes ("
). They can also be enclosed in matching groups of three single or double quotes (these are generally referred to as triple-quoted strings). The backslash (\
) character is used to escape characters that otherwise have a special meaning, such as newline, backslash itself, or the quote character...
关于python - Python中的 "string"和 'string'有什么区别吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/143714/