"Kent Johnson" <ken...@tds.net> wrote

I have a list with some values being NaN (after division-by-zero). How can I
check and remove all the NaN values?

In Python 2.6 you can use math.isnan() to check for NaN, so you can
filter your list by
newList = [ x for x in oldList if not math.isnan(x) ]

Interesting! How is a NaN stored in Python?
ie. How do you get to the point of having one in the first place?

Python continues is symbiosis with JavaScript...


--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to