AttributeError: 'NoneType' object has no attribute 'append'

拟输出一个日期列表:

file=open("C:/Users/jyz_1/Desktop/新建文本文档.txt")
file=file.read()
lsy=[]
dates=file.split("\n")
for date in dates:
    while "-" in date:
        p1=date.index('-')#the first -
        p2=date.find('-',p1+1)#the second -
        month=date[p1+1:p2]
        day=date[p2+1:-1]
    date_on_x=int(month+day)
    lsy=lsy.append(date_on_x)

报错:

Traceback (most recent call last):
  File "C:\Users\jyz_1\AppData\Local\Programs\Python\Python37-32\32rx.py", line 26, in <module>
    lsy=lsy.append(t)
AttributeError: 'NoneType' object has no attribute 'append'

难道lsy不是列表?
在shell中输入:

>>> lsy=[]
>>> a='2015-1-1'
>>> lsy.append(a)
>>> lsy
['2015-1-1']

结果正常。
百思不得其解,求大神解惑。

lsy是列表,但是append方法是没有返回值的

lsy=lsy.append(date_on_x) 改成 lsy.append(date_on_x) 就行了

你在shell中输入的不对啊,输入lsy = lsy.append(a) 你再看