1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] Assigning value to string in a list gets an error

Discussão em 'Python' iniciado por Stack, Setembro 11, 2025.

  1. Stack

    Stack Membro Participativo

    I have a simple list of two strings:

    indicator = ["unassigned","unassigned"]


    Under some conditions I want to change one of these.

    In a loop for k in range(0,2) I call a function which returns, among other things, a string called ind

    Then I have

    indicator[k] = ind


    This gets me: 'str' object does not support item assignment.

    What is my mistake?

    Continue reading...

Compartilhe esta Página