AttributeError: 'function' object has no attribute '_name_'
来源:互联网 发布:mysql数据库优化方案 编辑:程序博客网 时间:2024/06/12 19:49
def log(text):
def decorator(func):
def wrapper(*args,**kw):
print '%s %s():'%(text,func._name_)
return func(*args,**kw)
return wrapper
return decorator
@log('execute')
def now():
print '2016-10-20'
def decorator(func):
def wrapper(*args,**kw):
print '%s %s():'%(text,func._name_)
return func(*args,**kw)
return wrapper
return decorator
@log('execute')
def now():
print '2016-10-20'
print now()
AttributeError: 'function' object has no attribute '_name_'
def log(text):
def decorator(func):
def wrapper(*args,**kw):
print '%s %s():'%(text,func.__name__)
return func(*args,**kw)
return wrapper
return decorator
@log('execute')
def now():
print '2016-10-20'
print now()
错误就在红色标记处,结果是因为”__doc__“写成了”_doc_“:
0 0
- AttributeError: 'function' object has no attribute '_name_'
- 'function' object has no attribute '_name_'错误
- python 提示错误AttributeError: type object 'str' has no attribute '_name_'
- python机器学习实战3.2提示错误AttributeError: type object 'str' has no attribute '_name_'
- Python:AttributeError: 'function' object has no attribute '_doc_'
- AttributeError: 'classmethod' object has no attribute '__module__'
- AttributeError: 'module' object has no attribute 'getpass'
- AttributeError: ‘NoneType’ object has no attribute ‘clone’
- AttributeError: 'module' object has no attribute 'Serial'
- AttributeError: 'NoneType' object has no attribute 'clone'
- AttributeError: 'tuple' object has no attribute 'Multi'
- AttributeError: 'Response' object has no attribute 'json'
- AttributeError: 'module' object has no attribute(转)
- AttributeError: 'Connection' object has no attribute 'connection_errors'
- AttributeError: 'module' object has no attribute 'randint'
- AttributeError: 'module' object has no attribute 'HAVE_DECL_MPZ_POWM_SEC'
- AttributeError: 'WebDriver' object has no attribute
- AttributeError: 'NoneType' object has no attribute
- Android实战——科大讯飞语音听写SDK的使用,实现语音识别功能
- JavaSE的常见面试题
- 一个程序是怎样跑起来的(一)
- Android 系统常用ContentProvider URI
- 简单的面试算法题目
- AttributeError: 'function' object has no attribute '_name_'
- vxworks 下挂接tffs设备
- java.lang.NoClassDefFoundError解决方法
- 分别用for循环和while循环实现九九乘法表的正向打印和颠倒打印
- easyui-layout 模版
- Mybatis逆向工程
- Android内存图片缓存
- 图解MVC思想(模式)及简单案例演示
- 第四十三讲 项目 文件操作