for s in strategies:
strats_having_fcs = {a.strategy: a.algorithmType for a in s.algorithms if a.algorithmType == AlgorithmTypeEnum.feedback_control.value}
strats_having_fcs = {a.strategy: a.algorithmType for s in strategies for a in s.algorithms
if a.algorithmType == AlgorithmTypeEnum.feedback_control.value}
strats_having_fcs = {a.strategy: a.algorithmType for s in strategies for a in s.algorithms if a.algorithmType == AlgorithmTypeEnum.feedback_control.value}
IIUC,也许你在寻找这个嵌套的理解
只是:
看一下this关于列表理解的问题。对我来说,这澄清了很多这背后的逻辑是如何运作的
相关问题 更多 >
编程相关推荐