原文 待补充说明 -*- coding: utf-8 -*- def triangles(): L = [1] while True: yield L X = [0] + L Y = L + [0] L = [X[i] + Y[i] for i in range(len(X))]