Search code examples
pythonarraysfindinfinity

How can I make array B from array A without infinities included in Python 2.7?


Array A looks like this: [1, -inf, 2, 3, inf, -60.2]

Array B should look like this: [1, 2, 3, -60.2]

How can I make array B from array A without infinities included in Python 2.7?


Solution

  • B = filter(lambda x: abs(x) != float('inf'), A)