Assume you have a list
>>> m = ['a','b','c']
I'd like to make a new list n
that has everything except for a given item in m
(for example the item 'a'
). However, when I use
>>> m.remove('a')
>>> m
m = ['b', 'c']
the original list is mutated (the value 'a'
is removed from the original list). Is there a way to get a new list sans-'a'
without mutating the original? So I mean that m
should still be [ 'a', 'b', 'c' ]
, and I will get a new list, which has to be [ 'b', 'c' ]
.
my_var = m[0]
?