Oct-28-2020, 10:19 PM
(This post was last modified: Oct-28-2020, 10:19 PM by Gribouillis.)
Here are various ways to copy a list
>>> body = ["head","arms","legs"] >>> another = list(body) >>> another ['head', 'arms', 'legs'] >>> body.append('feet') >>> body ['head', 'arms', 'legs', 'feet'] >>> another ['head', 'arms', 'legs'] >>> one_more = [x for x in body] >>> one_more ['head', 'arms', 'legs', 'feet'] >>> again = body[:] >>> again ['head', 'arms', 'legs', 'feet'] >>> import copy >>> yet_another = copy.copy(body)