remove lists from a dictionary

Asked

Viewed 51 times

-2

I have a code that tests several combinations that are generated, but I have a memory error problem. I think the cause of this is that the dictionary gets too big to be processed, so I thought the solution might be to test the current list and at the same time remove the old one but I don’t know some command that fits with this situation. I’m new to Python

#gera a lista/dicionário
for subset in genComb:
    permsList.append(subset)

#testa se o item da lista é igual a uma variavel que é definida no inicio
while desco != senha:
    desco = str(permsList[num]).replace("'", '')
    desco = desco.replace(",", '')
    desco = desco.replace(" ", '')
    desco = desco.replace("(", '')
    desco = desco.replace(")", '')
    num += 1
  • what memory error is giving?

  • line 20, in passwords permsList.append(subset) Memoryerror

1 answer

0

It is probably by the same size, if you are testing all possible combinations for example of 13 different characters would already give 6.227.020.800 elements in your list and python has limit 536.870.912.

  • knows of any command that can erase the elements that have already been used?

  • for the list we have the . pop() that removes the last element and shows it, the . remove() that removes the element that you specify the . clear() that removes all.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.