title: How to compare an element of a tuple (int) to determine if it exists in a list
body: <p>I have the two following lists:</p>
  
  <pre><code># List of tuples representing the index of resources and their unique properties
  #    Format of (ID,Name,Prefix)
  resource_types=[('0','Group','0'),('1','User','1'),('2','Filter','2'),('3','Agent','3'),('4','Asset','4'),('5','Rule','5'),('6','KBase','6'),('7','Case','7'),('8','Note','8'),('9','Report','9'),('10','ArchivedReport',':'),('11','Scheduled Task',';'),('12','Profile','&lt;'),('13','User Shared Accessible Group','='),('14','User Accessible Group','&gt;'),('15','Database Table Schema','?'),('16','Unassigned Resources Group','@'),('17','File','A'),('18','Snapshot','B'),('19','Data Monitor','C'),('20','Viewer Configuration','D'),('21','Instrument','E'),('22','Dashboard','F'),('23','Destination','G'),('24','Active List','H'),('25','Virtual Root','I'),('26','Vulnerability','J'),('27','Search Group','K'),('28','Pattern','L'),('29','Zone','M'),('30','Asset Range','N'),('31','Asset Category','O'),('32','Partition','P'),('33','Active Channel','Q'),('34','Stage','R'),('35','Customer','S'),('36','Field','T'),('37','Field Set','U'),('38','Scanned Report','V'),('39','Location','W'),('40','Network','X'),('41','Focused Report','Y'),('42','Escalation Level','Z'),('43','Query','['),('44','Report Template ','\\'),('45','Session List',']'),('46','Trend','^'),('47','Package','_'),('48','RESERVED','`'),('49','PROJECT_TEMPLATE','a'),('50','Attachments','b'),('51','Query Viewer','c'),('52','Use Case','d'),('53','Integration Configuration','e'),('54','Integration Command f'),('55','Integration Target','g'),('56','Actor','h'),('57','Category Model','i'),('58','Permission','j')]
  
  # This is a list of resource ID's that we do not want to reference directly, ever.
  unwanted_resource_types=[0,1,3,10,11,12,13,14,15,16,18,20,21,23,25,27,28,32,35,38,41,47,48,49,50,57,58]
  </code></pre>
  
  <p>I'm attempting to compare the two in order to build a third list containing the 'Name' of each unique resource type that currently exists in <code>unwanted_resource_types</code>. e.g. The final result list should be: 
  <code>result = ['Group','User','Agent','ArchivedReport','ScheduledTask','...','...']</code></p>
  
  <p>I've tried the following that (I thought) should work:</p>
  
  <pre><code>result = []
  for res in resource_types:
      if res[0] in unwanted_resource_types:
          result.append(res[1])
  </code></pre>
  
  <p>and when that failed to populate <code>result</code> I also tried:</p>
  
  <pre><code>result = []
  for res in resource_types:
      for type in unwanted_resource_types:
          if res[0] == type:
              result.append(res[1])
  </code></pre>
  
  <p>also to no avail. Is there something i'm missing? I believe this would be the right place to perform list comprehension, but that's still in my grey basket of understanding fully (The Python docs are a bit too succinct for me in this case).</p>
  
  <p>I'm also open to completely rethinking this problem, but I do need to retain the list of tuples as it's used elsewhere in the script. Thank you for any assistance you may provide. </p>