Removing an element from a list based on a predicate

前端 未结 9 1279
伪装坚强ぢ
伪装坚强ぢ 2021-01-18 12:36

I want to remove an element from list, such that the element contains \'X\' or \'N\'. I have to apply for a large genome. Here is an example:

9条回答
  •  北海茫月
    2021-01-18 13:22

    There is also the method of doing it using filter

        lst = filter(lambda x: 'X' not in x and 'N' not in x, list)
    

提交回复
热议问题