我一直收到这样的信息:
DeprecationWarning: integer argument expected, got float
我该如何让这个信息消失?有没有办法避免Python中的警告?
我一直收到这样的信息:
DeprecationWarning: integer argument expected, got float
我该如何让这个信息消失?有没有办法避免Python中的警告?
从warnings
module人的文件中:
#!/usr/bin/env python -W ignore::DeprecationWarning
如果您使用的是Windows:将-W ignore::DeprecationWarning
作为参数传递给Python.不过,更好的方法是通过将值设置为int来解决该问题.
(请注意,在Python 3.2中,默认情况下会忽略弃用警告.)