我收到此错误,但无论我选择缩进它,我仍然收到它,你知道为什么吗?
if len(argmaxcomp) == 1:
print "The complex with the greatest mean abundance is: {0}"\
.format(argmaxcomp[0])
一般来说,pep8 建议您更喜欢括号而不是连续行 https://www.python.org/dev/peps/pep-0008/#maximum-line-length.
换行长行的首选方法是在圆括号、方括号和大括号内使用 Python 的隐式续行。通过将表达式括在括号中,可以将长行分成多行。应优先使用这些内容而不是使用反斜杠来继续行。
That is:
if len(argmaxcomp) == 1:
print("The complex with the greatest mean abundance is: {0}"
.format(argmaxcomp[0]))
另一种选择是使用 python 3 的打印:
from __future__ import print_function
if len(argmaxcomp) == 1:
print("The complex with the greatest mean abundance is:", argmaxcomp[0])
注意: print_function 可能会中断/需要更新其余代码......在您使用过 print 的任何地方。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)