arange是numpy中的函数,所以要先调用numpy from numpy as np np.arange(0,1,0.01) #0是start,1是stop,0.01是步长。 但在range中,只能是整数,不能是浮点数。