Python - IndentationError:预期缩进块(涉及类的异常缩进错误)

iro*_*man -6 python class

在尝试开发一个类时,我遇到了这个错误.

from __future__ import division
import numpy as np
import scipy as sp
import itertools as it
from scipy.integrate import quad
import astropy.cosmology
from astropy import units as u

class NFW:  

File "/Users/alexandres/Illustris/Scripts/NFWprofile2.py", line 10

               ^
IndentationError: expected an indented block
[Finished in 0.1s with exit code 1]
[shell_cmd: python -u "/Users/alexandres/Illustris/Scripts/NFWprofile2.py"]
[dir: /Users/alexandres/Illustris/Scripts]
[path: /usr/bin:/bin:/usr/sbin:/sbin]
Run Code Online (Sandbox Code Playgroud)

这是一个缩进错误怎么样?

无论我将类定义为NFW()NFW(object),都会发生这种情况.

这是通过Sublime 3编辑的

Rob*_*obᵩ 5

如果这是您的整个文件,那么您将错过所需的正文.您可以使用以下pass语句创建一个空体:

class NFW:  
    pass
Run Code Online (Sandbox Code Playgroud)