gpt4 book ai didi

python - Python中的 "string"和 'string'有什么区别吗?

转载 作者:IT老高 更新时间:2023-10-28 21:45:18 29 4
gpt4 key购买 nike

在 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/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com