我总是听到这个:
DeprecationWarning: integer argument expected, got float
我怎样才能让这条信息消失?在Python中有避免警告的方法吗?
我总是听到这个:
DeprecationWarning: integer argument expected, got float
我怎样才能让这条信息消失?在Python中有避免警告的方法吗?
当前回答
对于python 3,只需编写下面的代码来忽略所有警告。
from warnings import filterwarnings
filterwarnings("ignore")
其他回答
注释掉下面文件中的警告行:
lib64/python2.7/site-packages/cryptography/__init__.py
Python 3
在编写代码之前,只需在下面写下容易记住的行:
import warnings
warnings.filterwarnings("ignore")
将实参转换为int。这很简单
int(argument)
有点粗糙,但它为我工作后,上述方法没有。
- myscrypt。py 2 > / dev /空
你应该修改你的代码,但以防万一,
import warnings
warnings.filterwarnings("ignore", category=DeprecationWarning)