python-8-处理runtimewarning:invalid value encountered in divide

(1)忽略掉异常信息
import numpy as np
np.seterr(divide=‘ignore’, invalid=‘ignore’)
a = np.array([1.0,2.0])
b = np.array([0])
print(a/b)

你可能感兴趣的:(python3,python)