PyCharm shows "PEP8: expected 2 blank lines, found 1"

march_seven picture march_seven · Oct 27, 2016 · Viewed 73.1k times · Source

Consider the following code:

def add_function(a, b):
    c = str(a) + b
    print "c is %s" % c

def add_int_function(c, d):
    e = c + d
    print "the vaule of e is %d" % e

if __name__ =="__main__":
    add_function(59906, 'kugrt5')
    add_int_function(1, 2)

It always shows me: "expected 2 blank lines ,found 1" in aadd_int_function, but not in the add_function.

When I add two spaces in front of the def add_int_function(c, d): there is a error shows unindent does not match any outer indentation level in the end of add_function:

enter image description here

enter image description here

Answer

Kennet Celeste picture Kennet Celeste · Oct 27, 2016

Just add another line between your function definitions :

1 line :

enter image description here

2 lines:

enter image description here