我对此有疑问 它一直在说:NoneType对象没有属性计数
def failListiks(failinimi):
with open(failinimi) as f:
listina = f.readlines()
print(listina)
return
minulist = failListiks("sonad.txt")
tahtedearv = minulist.count("a")
print(tahtedearv)
答案 0 :(得分:0)
failListiks
返回None
。我怀疑您想返回行列表,但是您只是在打印它们。进行以下更改:
def failListiks(failinimi):
with open(failinimi) as f:
listina = f.readlines()
print(listina)
return listina # return the lines