本文共 508 字,大约阅读时间需要 1 分钟。
AttributeError: 'function' object has no attribute 'func_name'
python2升级到python3报的错,
python3.0的函数没有func_name属性了,改成了__name__.
详见 官方文档:
The function attributes named func_X
have been renamed to use the __X__
form, freeing up these names in the function attribute namespace for user-defined attributes. To wit, func_closure
, func_code
, func_defaults
, func_dict
, func_doc
, func_globals
, func_name
were renamed to __closure__
, __code__
, __defaults__
, , __doc__
, __globals__
, , respectively.
__nonzero__()
is now .
转载地址:http://nkxws.baihongyu.com/