擅长:python、mysql、java
<p>我们可以在<strong>python3.8中使用<a href="https://docs.python.org/3.8/whatsnew/3.8.html#assignment-expressions" rel="nofollow noreferrer">assignment expressions</a>:</p>
<pre><code>if (result := get_something()) is not None:
# do something with result
</code></pre>