我如何关注换行符关于python PEP8,它有多重要?

时间:2016-01-19 11:07:25

标签: python pep8 gedit python-3.5 pyflakes

我正在使用python 3.5.1编写,我是一名编程新手。

我根据pep8使用带有pyflakespython style guide插件的gedit来显示样式错误。我不知道是否要遵循风格推荐信。

但是,我有E501: line too long (80 > 79 characters)E502: the backslash is redundant between bracketsE128/E127/...: continuation line under-indented for visual indent表示的三种反复出现的样式缺陷。屏幕截图如下。

我的两个问题是:

  1. 如何在python中充分划线以避免E501以及后续的样式错误E502E127/128
  2. 在信件中遵循样式指南pep8是否有帮助,特别是考虑到出版物?高级python程序员说什么?
  3. E501: enter image description here

    E502: enter image description here

    E127 / 128 ...: enter image description here

1 个答案:

答案 0 :(得分:7)

“为了避免E501以及随后的样式错误E502和E127 / 128,我如何才能在python中进行换行?”

progress = Utils.ProgressMeter('Source strings separated by white '
    'space are automatically concatenated by the '
    'interpreter and parenthesis are the natural syntax '
    'for line continuation. Remember to use trailing '
    'spaces.')

由于错误E502已在括号内,因此反斜杠是多余的。你试过消除它吗?