python3 AttributeError:&x27;int';对象没有属性';长度';
嗨,我正在尝试修复这个属性错误,并且已经做了一天半了。我是python新手,尝试将结构化英语代码(伪代码)转换为项目的Python3python3 AttributeError:&x27;int';对象没有属性';长度';,python,python-3.x,Python,Python 3.x,嗨,我正在尝试修复这个属性错误,并且已经做了一天半了。我是python新手,尝试将结构化英语代码(伪代码)转换为项目的Python3 Output: Traceback (most recent call last): File "test.py", line 31, in <module> passwordVerifier(password) File "test.py", line 16, in passwordVerifier passwordArr
Output:
Traceback (most recent call last):
File "test.py", line 31, in <module>
passwordVerifier(password)
File "test.py", line 16, in passwordVerifier
passwordArray = password.length()
AttributeError: 'int' object has no attribute 'length'
passwordArray=len(密码)
要检查字符串的长度,请使用len
所以对于int
passwordArray=len(str(password))
passwordArray=[0]
passwordArray=bytes([])
passwordArray=password.length()
您希望在这里实现什么?部分伪代码说将passwordArray设置为(空字节数组)设置passwordArray[0]TO Password.Length将Password追加到PasswordArray
其混淆原因类似于我多次写入同一变量。您的标题:“AttributeError:'int'对象没有属性'isdigit'”与您的错误代码不匹配:AttributeError:'int'对象没有属性'length'我刚尝试过,现在我得到了TypeError:type'int'对象没有len()
使用较低的一个
#!/bin/python3
import os
import sys
import numpy
import office2john
def passwordVerifier(password):
password = str(password)
verifier = [numpy.uint16(1)]
passwordArray = [numpy.uint8(1)]
verifier = 0x0000
passwordArray = [0]
passwordArray = bytes([])
passwordArray = password.length()
for password in passwordArray:
intermediate1 = 0
if password in passwordArray:
intermediate1 = 1
else:
intermediate2 = verifier * 2
intermediate3 = intermediate1
verifier = intermediate3
return verifier