[Solved] Python trying to clear and reuse list [duplicate]
You should write inbracket = list(newstrlist); for the assignment, otherwise your lists will be pointers to the same actual element, and modifying newstrlist will modify inbracket. 3 solved Python trying to clear and reuse list [duplicate]