行太长。 Django PEP8 [英] Line is too long. Django PEP8
本文介绍了行太长。 Django PEP8的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
PEP8信息:
models.py:10:80: E501 line too long (83 > 79 characters)
Models.py:
Models.py:
field = TreeForeignKey('self', null=True, blank=True, related_name='abcdefgh')
如何正确编写此行?
推荐答案
这是正确的,PEP8仅标记了超过79行长字符。但是,如果您对此感到担心,可以这样写:
It's "correct", PEP8 just flags lines over 79 characters long. But if you're concerned about that, you could write it like this:
field = TreeForeignKey('self',
null=True,
blank=True,
related_name='abcdefgh')
或者这样:
field = TreeForeignKey(
'self',
null=True,
blank=True,
related_name='abcdefgh',
)
或者,实际上,任何其他将单行分解为多行短行的样式。
Or, really, any other style that would break the single line into multiple shorter lines.
这篇关于行太长。 Django PEP8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文