As shown in the example above, when print(output string representation, the unicode string is uniformly expressed in single quotes. In this example, the elements "a ", "6 "and" c" in the list are printed as a string of characters. Why is the output in sin

denise222 注册会员
2023-02-28 00:06

  • In Python, both single and double quotes can be used to represent strings. If the string contains single quotation marks, you can use double quotation marks to represent the string. When a string contains double quotation marks, you can use single quotation marks to represent the string. Therefore, the output is in single or double quotes, depending on which way the Python interpreter chooses to be more convenient and consistent.
  • In the given example, the Python interpreter has chosen to use single quotes to represent string elements in a list because single quotes are more commonly used and idiomatic than double quotes in Python. However, either single or double quotation marks can be used to represent strings, and either form is correct.

About the Author

Question Info

Publish Time
2023-02-28 00:06
Update Time
2023-02-28 00:06

Related Question


srun: error: Unable to allocate resources: Invalid node name specified

Python Hatch: ' ERROR: Package ' Hatch -demo'需要不同的Python: 3.10.5 not in '<3.10,>=3.9' '

linux中sed -i命令使用问题




spring gateway 和 nacos 之间的关系?


在Python - Windows中读取USB流