这里是我的代码:为什么追加到列表会在Python中引发一个NoneType错误?
text="""col1 col2 col3
a 1 $
b 2 @
c 3 &
"""
mList = []
for line in text.splitlines():
for item in line.split(" "):
mList = mList.append(item)
这就提出了一个错误,'NoneType' object has no attribute 'append'
。我尝试了其他方式来创建列表并执行此操作,但我得到的最好的列表是转到None
。这里发生了什么?