如何正确的使用单引号和双引号
作者:互联网
撇号位于两个双引号之间,因此Python解释器能够正确地理解这个字符串:
message="One of Python's strengths is its diverse community."
print(message)
执行结果
One of Python's strengths is its diverse community.
然而,如果你使用单引号,Python将无法正确地确定字符串的结束位置:
message='One of Python's strengths is its diverse community.'
print(message)
执行结果
File "D:/app/workspace/pythonProject/study_python/day1/apostrophe.py", line 4
message='One of Python's strengths is its diverse community.'
^
SyntaxError: invalid syntax
标签:正确,双引号,Python,单引号,community,diverse,message,strengths,its 来源: https://www.cnblogs.com/cy-xt/p/16074449.html