Update item value inside python dictonary

Asked

Viewed 25 times

0

SCRIPT

for row in result_psql:
    if row in lds_data:
        print(lds_data[row]['status'])
    else: 
        continue

OUTPUT

NO

GOAL

I would like to update the value IN THE for YES

STRUCTURE OF THE DICT

lds_data = {cod_cliente: {'status': 'NO', 'nome_cliente': 'NOME_TESTE'}}
  • 1

    Would not be lds_data[row]['status'] = 'YES'?

  • It worked out buddy, I was trying with . update(), thank you very much!

No answers

Browser other questions tagged

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