如何消除python中的VisibleDeprecationWarning\ DeprecationWarning等類似警告:


轉自:https://blog.csdn.net/weixin_41884148/article/details/88783554

如何消除python中的VisibleDeprecationWarning\ DeprecationWarning等類似警告:

我們在寫相關代碼時總會有一些警告,雖然並不影響結果,但是很影響美觀。如果在不急於解決警告的情況下我們可以選擇一些方法進行忽略。
eg:

VisibleDeprecationWarning: boolean index did not match indexed array along dimension 0;

DeprecationWarning: This function is deprecated. Please call randint(0, 1 + 1) instead;

添加代碼如下:

import warnings
warnings.filterwarnings("ignore", category=Warning)

原文鏈接:https://blog.csdn.net/weixin_41884148/article/details/88783554


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM