Python 如何去掉列表中的引号?

图片说明
请教各位大佬们
如图,如何用Python实现由A转换成B
论坛里的方法:replace和join貌似对我没用......
多谢了!

# encoding: utf-8

def foo(x):
    if type(x) == str:
        return float(x)
    return x;

A = [0,0,0,'NaN',0]
B = list(map(foo, A))
print(B)

A = [0,0,'NAN',0]
B = [float(item) if item=="NAN" else item for item in A]