<pre><code>for s in strategies:
strats_having_fcs = {a.strategy: a.algorithmType for a in s.algorithms if a.algorithmType == AlgorithmTypeEnum.feedback_control.value}
</code></pre>
<p>通过理解我们能把它写成一行吗</p>
<p>IIUC,也许你在寻找这个嵌套的理解</p>
<pre><code>strats_having_fcs = {a.strategy: a.algorithmType for s in strategies for a in s.algorithms
if a.algorithmType == AlgorithmTypeEnum.feedback_control.value}
</code></pre>