擅长:python、mysql、java
<p>跳转目标由反汇编输出中的<code>>></code>注释。你知道吗</p>
<p>例如,在:</p>
<pre><code>def f(i):
if i == 1:
return 1
elif i == 2:
return 2
</code></pre>
<p><code>dis.dis(f)</code>显示:</p>
<pre><code> 2 0 LOAD_FAST 0 (i)
3 LOAD_CONST 1 (1)
6 COMPARE_OP 2 (==)
9 POP_JUMP_IF_FALSE 16
3 12 LOAD_CONST 1 (1)
15 RETURN_VALUE
4 >> 16 LOAD_FAST 0 (i)
19 LOAD_CONST 2 (2)
22 COMPARE_OP 2 (==)
25 POP_JUMP_IF_FALSE 32
5 28 LOAD_CONST 2 (2)
31 RETURN_VALUE
>> 32 LOAD_CONST 0 (None)
35 RETURN_VALUE
</code></pre>
<p>和<code>dis.findlabels(f.__code__.co_code)</code>返回<code>[16, 32]</code>。你知道吗</p>