打印杨辉三角前6行 lst= [1,[1,1]]for i in range(2,6): pre = lst[i-1] cur = [1] for j in range(0,i-1): cur.append(pre[j]+pre[j+1]) cur.append(1) lst.append(cur) print(lst)