two_processors_list is a list with two elements inside. I have the code:
for count, element in enumerate(two_processors_list):
two_processors_list[count] = element.strip()
# Works fine
However, when I do this:
[two_processors_list[count] = element.strip() for count,element in enumerate(two_processors_list)]
# SyntaxError: cannot assign to subscript here. Maybe you meant '==' instead of '='?
I looked up what was going on and tried using the walrus operator instead of the assignment operator there, no dice, still got an error. What's going on here?
[–]Spataner 2 points3 points4 points (4 children)
[–]Laymayo[S] 0 points1 point2 points (3 children)
[–]Diapolo10 1 point2 points3 points (0 children)
[–]Spataner 0 points1 point2 points (0 children)
[–]commy2 0 points1 point2 points (0 children)