I get this error but however I choose to indent it, I still get it, do you know why?
if len(argmaxcomp) == 1:
print "The complex with the greatest mean abundance is: {0}"\
.format(argmaxcomp[0])
Generally pep8 suggests you prefer parenthesis over continuation lines.
The preferred way of wrapping long lines is by using Python's implied line continuation inside parentheses, brackets and braces. Long lines can be broken over multiple lines by wrapping expressions in parentheses. These should be used in preference to using a backslash for line continuation.
That is:
if len(argmaxcomp) == 1:
print("The complex with the greatest mean abundance is: {0}"
.format(argmaxcomp[0]))
Another option, is to use python 3's print:
from __future__ import print_function
if len(argmaxcomp) == 1:
print("The complex with the greatest mean abundance is:", argmaxcomp[0])
Note: print_function may break/require updating the rest of the code... anywhere you've used print.
The problem in this case is that there is no indentation at all and obviously the error occurs in the last line. In case parentheses are not an option just add indentation as below:
if len(argmaxcomp) == 1:
print "The complex with the greatest mean abundance is: {0}" \
.format(argmaxcomp[0])
Any amount of spaces works but I don't know what is preferred.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With