由于PEP8建议保持低于你的python程序的80列规则,我怎么能遵守长字符串,即
s = "this is my really, really, really, really, really, really, really long string that I'd like to shorten."
Run Code Online (Sandbox Code Playgroud)
我将如何将其扩展到以下行,即
s = "this is my really, really, really, really, really, really" +
"really long string that I'd like to shorten."
Run Code Online (Sandbox Code Playgroud) 我得到了这个错误但是我选择缩进它,我仍然得到它,你知道为什么吗?
if len(argmaxcomp) == 1:
print "The complex with the greatest mean abundance is: {0}"\
.format(argmaxcomp[0])
Run Code Online (Sandbox Code Playgroud) 我可以使用以下语法创建多行字符串:
string = str("Some chars "
"Some more chars")
Run Code Online (Sandbox Code Playgroud)
这将产生以下字符串:
"Some chars Some more chars"
Run Code Online (Sandbox Code Playgroud)
Python是加入这两个单独的字符串还是编辑器/编译器将它们视为单个字符串?
Ps:我只想了解内部情况.我知道还有其他方法来声明或创建多行字符串.