def y_(): L=[1] while True: yield L L.append(0) L.insert(0,0) L=[L[x]+L[x+1] for x in range(len(L)-1)]
for x in L表示从L中取出数值,不是表示L的长度改成L=[L[x]+L[x+1] for x in range(len(L)-1)] ,改成for x in range(len(L)-1)才能表示从0到L长度减一的下标,