python - Remove list element without mutation - Stack Overflow

PHOTO EMBED

Wed Jan 12 2022 05:40:19 GMT+0000 (Coordinated Universal Time)

Saved by [deleted user]

m = ['a', 'b', 'c']
n = [x for x in m if x != 'a']
content_copyCOPY

https://stackoverflow.com/questions/25004347/remove-list-element-without-mutation/25004389