如何消除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
作者:楚千羽
出处:https://www.cnblogs.com/chuqianyu/
本文来自博客园,本文作者:楚千羽,转载请注明原文链接:https://www.cnblogs.com/chuqianyu/p/15024021.html
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须在文章页面给出原文连接,否则保留追究法律责任的权利!