I have a string called "sakla" where I want to add variable at the end of it and set it to 1 but getting SyntaxError: Can't assign to operator with the below code:
i=0
string = "sakla"
for i in range(9):
string + str(i) =1
i= i+1
My desired outout as follows:
sakla0=1
sakla1=1
sakla2=1
etc...
sakla9=1
Where I am doing wrong ? I need to set to 1 because at some other place I am setting to zero which I am using to hide some colomns at my django template. When I am writing each one by one,my code is working but it doesn't look good.So I need help for the improvement :)
EDİT: Maybe I couldn't express myself while asking the question but the questions that you referenced as duplicate it's not related to what I am after. I just need to set some strings to 1 while doing that I need to increase these string names one by one. You might ask why you want this. The reason is that I am hiding some cells within the django template. So if the value is lets say sakla = 0 then the template is hidden if not it's not hidden.So I only need to set to 1 some string names where it's not working within the django the examples that I found,so I asked this question.
Here is my template codes:
{%if sakla == 0%}
<div style="display:none">
{% elif sakla == 1 %}
<div>
{% endif %}