Getting Error while try to combine variable name with string in python to form a new variable

Viewed 16

Getting Error while tried to combine variable name with string in python to form a new variable.[SyntaxError: cannot assign to operator]

Eg1:

variable = "str1"
variable + "str2" = []

Now i am trying to get a variable of str1str2 = []

Eg2:

list = ["str1","str2"]
for value in list:
     value + "str3" = []

Now i am trying to get a variable of str1str3 = [] and str2str3 = []

but instead I am getting SyntaxError: cannot assign to operator

0 Answers
Related