dimanche 6 décembre 2020

AttributeError: 'list' object has no attribute 'sample'

I ask user to enter min_number and max_number. For example user set min_number: 2 and max_number: 6

Random give me [3, 5] and this error

random = random.sample(range(1, 80), min_number) AttributeError: 'list' object has no attribute 'sample'

'list' object has no attribute 'sample'

while min_number <= max_number:
        random = random.sample(range(1, 10), min_number)
        print (random)
        for j in random:
            element = wait.until(EC.element_to_be_clickable((By.XPATH, f'//*[@id="app"]/div/div[3]/div/div[1]/div[{j}]/div')))
            element.click()
            time.sleep(1)
            j += j

        min_number += min_number



Aucun commentaire:

Enregistrer un commentaire