简体   繁体   English

Python错误:AttributeError:'builtin_function_or_method'对象没有属性

[英]Python Error: AttributeError: 'builtin_function_or_method' object has no attribute

I'm getting this error: 我收到此错误:

Traceback (most recent call last):
  File "crack.py", line 12, in <module>
    filemd5 = md5.new(password.strip()).hexdigest()
AttributeError: 'builtin_function_or_method' object has no attribute 'new'

I'm trying to fix but i can't 我正在尝试修复,但无法

Here is my code: 这是我的代码:

from hashlib import md5
for password in pwfile:
    filemd5 = md5.new(password.strip()).hexdigest()

That's because md5 is, as the error says, a function of the hashlib module 正如错误所言,这是因为md5hashlib模块的功能

>>> from hashlib import md5
>>> type(md5)
<class 'builtin_function_or_method'>

I guess what you want to do is the following: 我想您要执行以下操作:

>>> h = md5()  # Returns a hash object.
>>> h.update(password)  # Make sure password is a bytes object.
>>> h.hexdigest()

More information is here . 更多信息在这里

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Python:AttributeError:“ builtin_function_or_method”对象没有属性“ sleep” - Python: AttributeError: 'builtin_function_or_method' object has no attribute 'sleep' 错误:AttributeError: 'builtin_function_or_method' object 没有属性 'append' - Error: AttributeError: 'builtin_function_or_method' object has no attribute 'append' AttributeError: &#39;builtin_function_or_method&#39; 对象没有属性 &#39;fieldnames&#39; - AttributeError: 'builtin_function_or_method' object has no attribute 'fieldnames' AttributeError:“ builtin_function_or_method”对象没有属性“ count” - AttributeError: 'builtin_function_or_method' object has no attribute 'count' AttributeError: &#39;builtin_function_or_method&#39; 对象没有属性 &#39;csv&#39; - AttributeError: 'builtin_function_or_method' object has no attribute 'csv' AttributeError:“ builtin_function_or_method”对象没有属性“ pop” - AttributeError: 'builtin_function_or_method' object has no attribute 'pop' AttributeError:“ builtin_function_or_method”对象没有属性“ split” 3.7 - AttributeError: 'builtin_function_or_method' object has no attribute 'split' 3.7 AttributeError:“ builtin_function_or_method”对象没有属性“ addLayout” - AttributeError: 'builtin_function_or_method' object has no attribute 'addLayout' AttributeError: 'builtin_function_or_method' object 没有属性 'split' - AttributeError: 'builtin_function_or_method' object has no attribute 'split' AttributeError:“ builtin_function_or_method”对象没有属性“ iterkeys” - AttributeError: 'builtin_function_or_method' object has no attribute 'iterkeys'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM