擅长:python、mysql、java
<p>如果不想全部删除(感谢<a href="https://stackoverflow.com/a/7484605/623735">the tip</a><a href="https://stackoverflow.com/users/16102/cat-plus-plus">@CatPlusPlus</a>):</p>
<pre><code>testLogger.handlers = [
h for h in testLogger.handlers if not isinstance(h, logging.StreamHandler)]
</code></pre>