python报错 AttributeError: 'numpy.ndarray' object has no attribute 'write'

    with open('表示.txt','a',encoding='utf-8') as f:
        with open('a-0.txt','r',encoding='utf-8')as f0:
            a=eval(f0.read())
            out={}
            for keys in a.keys():
                s = 0.0
                for word in a[keys].keys():
                    try:
                        k,f=search(word)
                    except KeyError:continue
                    for kk in k:
                        s+=kk*a[keys][word]
                try:
                    s =s.tolist()
                except:continue
                print(type(s))
                print(str(out))
                f.write(str(s))
原本想要写入s但是不知道为什么总是上面的错误,一开始是一位np的原因改了s的属性后还是报错?s是一个浮点数类似于0.012947777285584253这样子
求指教
我想要达到的结果