首页 > 编程语言 > 详细

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

时间:2021-07-17 18:09:30      阅读:25      评论:0      收藏:0      [点我收藏+]

转自: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

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

原文:https://www.cnblogs.com/chuqianyu/p/15024021.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!