python的warnings.filterwarnings(“ignore“)

在python中运行代码经常会遇到的情况是------代码可以正常运行但是会提示警告,如果想要去掉这些警告,可以使用python的warnings.filterwarnings("ignore")函数。

代码:

cpp 复制代码
import warnings
warnings.filterwarnings('ignore')

看一下这个函数:

cpp 复制代码
warnings.filterwarnings(action, 
						message='', 
						category=Warning, 
						module='', 
						lineno=0, 
						append=False)
  • action 可以填以下的值:
  • 示例
相关推荐
门框研究员6 小时前
解锁Python的强大能力:深入理解描述符
python
子不语1808 小时前
Python——函数
开发语言·python
daidaidaiyu8 小时前
一文入门 LangChain 开发
python·ai
JJ1M89 小时前
用 Python 快速搭建一个支持 HTTPS、CORS 和断点续传的文件服务器
服务器·python·https
汤姆yu9 小时前
基于python大数据的小说数据可视化及预测系统
大数据·python·信息可视化
x***J3489 小时前
Python多线程爬虫
开发语言·爬虫·python
m***D2869 小时前
Python网络爬虫实战案例
开发语言·爬虫·python
ID_1800790547310 小时前
基于 Python 的淘宝商品详情数据结构化解析:SKU、价格与库存字段提取
开发语言·数据结构·python
Laughtin10 小时前
终端Python环境的选择与切换
开发语言·python
JHC00000011 小时前
Python PDF 相关操作
开发语言·python·pdf