如何在没有Python 2.7中包含的无穷大的情况下从数组A创建数组B?

use*_*474 0 python arrays find infinity

数组A看起来像这样:[1,-inf,2,3,inf,-60.2]

数组B应如下所示:[1,2,3,-60.2]

如何在没有Python 2.7中包含的无穷大的情况下从数组A创建数组B?

Clu*_*ess 6

B = [x for x in A if not math.isinf(x)]
Run Code Online (Sandbox Code Playgroud)