"PEP:8 expected 2 blank lines ,found 1"

"PEP:8 expected 2 blank lines ,found 1"

 

pycharm shows "PEP:8 expected 2 blank lines ,found 1"

用pycharm写python的时候,总会在def function()的那行出现如上问题。
解决办法:参考了【pycharm shows expected 2 blank lines ,found 1】

具体原因就是呢,在声明函数的那一行的上方必须有两行的空行,否则便出现这个情况。
函数的注释可随函数为一体,即,下面两种方法均可

# coding: utf-8
# fun1
def func1():
    return 0
# fun2


def func2():
    return 1
# coding: utf-8
# fun1
def func1():
    return 0

# fun2
def func2():
    return 1
posted @ 2019-06-23 10:06  菜鸡一枚  阅读(876)  评论(0编辑  收藏  举报