python - Removing an element from a list based on a predicate -


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

Input:

  codon = ['AAT', 'XAC', 'ANT', 'TTA Expected output:  
  codon = ['AAT', 'TTA']  
P>

for the base purpose

  & gt; & Gt; & Gt; ['AAT', 'TTA']] ['AAT', 'TTA'] ['AAT', 'TTA'] [x] if x is not in x and x is not "x" for x in ['AAT', 'XAC', 'ANT'] 'TTA' / Pre> 

But if you have a large amount of data, then I recommend that you dict or set

and if you have many letters other than X and N, then you You can do this

  & gt; & Gt; & Gt; [X for X for X ['AAT', 'XAC', 'ANT', 'TTA'] if none (for f in the list f (x) if ["x", "n", "y "Note:  List (x)  may just be  x , and  [" X "," N "," Y "," Z "," K "," J "]  can simply be " XNYZKJ ", and the answer to JeanBuller, he did the best. 


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

jquery - SimpleModal Confirm fails to submit form -

php - Multiple Select with Explode: only returns the word "Array" -