【发布时间】:2015-09-26 08:56:57
【问题描述】:
这是一个学校项目,这只是存在错误的代码的一部分,当我尝试附加我的第二个变量时出现错误
def info():
f=open('info.txt','a')
ch='y'
while ch=='y':
l=[]
x=raw_input('enter staff id')
l=l.append(x)
dob=raw_input("enter date of birth")
l=l.append(dob)
doj=raw_input('enter date of joining')
l=l.append(doj)
t=raw_input('enter duty time')
l=l.append(t)
sal=input('enter salary per month')
l=l.append(sal)
f.append(l)
ch=raw_input('want to enter more info')
错误:
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
info()
File "C:/Python27/staff info.py", line 9, in info
l=l.append(dob)
AttributeError: 'NoneType' object has no attribute 'append'
【问题讨论】:
标签: python