There is a list
lst = ['x', 'x123', 'x2345', 'x23461243'] def function(lst): for x in lst: for i in lst: if x in i: mass.remove(x) It is necessary to obtain a list of all values in which x is present, and remove a single x from the list.
returning_mass = ['x123', 'x2345', 'x23461243'] How to do it? The code above does not work correctly.
returning_mass = [i for i in lst if i != 'x']- gil9red