Darrin Spell Jr
Darrin Spell Jr

Reputation: 11

python3 AttributeError: 'int' object has no attribute 'length'

Hi I am trying to fix this AttributeError and been at it for a day and a half now. I am new to python trying to convert structured english code (pseudo code) to python 3 for a project.

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'
#!/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

Upvotes: 1

Views: 1960

Answers (1)

Kuldeep Singh Sidhu
Kuldeep Singh Sidhu

Reputation: 3856

passwordArray = len(password)

to check length of a string use len

so for int

passwordArray = len(str(password))

Upvotes: 1

Related Questions