➜

This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

作者 amaury.forgeotdarc
收信人 amaury.forgeotdarc, cliffdover88
日期 2008-10-21.21:05:18
SpamBayes Score 0.00086039025
Marked as misclassified 否
Message-id <1224623120.06.0.836045478568.issue4164@psf.upfronthosting.co.za>
In-reply-to
内容
All your samples explain easily if you consider that two adjacent string 
literals are joined together. (You seem to consider that "double quote" 
is a way to insert a quote character. It's not; Python is not Pascal or 
SQL)

Your first two examples become:
a='a''a'   two adjacent strings == 'aa'
a='a''''a' three adjacent strings ('a' + '' + 'a') == 'aa'

The third is an error:
a='a''''''a' one string ('a') followed by the beginning of a "triple 
quoted string" (''') which content starts with the characters (''a') but 
does not have a matching (''') to finish the string, hence the Syntax 
error.

... and so on. Please have a look at http://docs.python.org/reference/lexical_analysis.html#string-literals
历史
日期 用户 动作 参数
2008-10-21 21:05:20amaury.forgeotdarc修改recipients: + amaury.forgeotdarc, cliffdover88
2008-10-21 21:05:20amaury.forgeotdarc修改messageid: <1224623120.06.0.836045478568.issue4164@psf.upfronthosting.co.za>
2008-10-21 21:05:19amaury.forgeotdarc链接issue4164 messages
2008-10-21 21:05:18amaury.forgeotdarc创建