【发布时间】:2021-10-15 02:58:23
【问题描述】:
这是我的 Python 代码的一部分:
pstat1 = [plotvex(alpha,beta,j)[0] for j in range(5)]
ptset1 = [plotvex(alpha,beta,j)[1] for j in range(5)]
其中plotvex 是一个返回2 个项目的函数。我想使用列表理解生成两个列表pstat1 和ptset1,但我想知道有没有一种方法我不需要调用该函数两次?谢谢:)
【问题讨论】: