我一直这样:DeprecationWarning: integer argument expected, got float如何让这条消息消失?有没有办法避免Python中的警告?
3 回答

万千封印
TA贡献1891条经验 获得超3个赞
从warnings模块的文档:
#!/usr/bin/env python -W ignore::DeprecationWarning
如果你在Windows上:-W ignore::DeprecationWarning作为参数传递给Python。尽管通过强制转换为int来解决问题更好。
(请注意,在Python 3.2中,默认情况下会忽略弃用警告。)
添加回答
举报
0/150
提交
取消