且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在Python中忽略弃用警告

更新时间:2022-04-23 01:34:00

来自 警告模块

 #!/usr/bin/env python -W ignore::DeprecationWarning

如果在Windows上:将 -W忽略:: DeprecationWarning 作为Python的参数。***通过强制转换为 int

If you're on Windows: pass -W ignore::DeprecationWarning as an argument to Python. Better though to resolve the issue, by casting to int.

(请注意,在Python 3.2中,默认情况下会弃用警告。)

(Note that in Python 3.2, deprecation warnings are ignored by default.)