Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
python3 AttributeError:&x27;int';对象没有属性';长度';_Python_Python 3.x - Fatal编程技术网

python3 AttributeError:&x27;int';对象没有属性';长度';

python3 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

嗨,我正在尝试修复这个属性错误,并且已经做了一天半了。我是python新手,尝试将结构化英语代码(伪代码)转换为项目的Python3

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