title: Filtering a list of lists of a tuple with regex
body: <p><strong>SEE EDIT NEAR THE BOTTOM</strong></p>
  
  <p>i'm just learning python.  I'm trying to filter a list of lists of a tuple to only keep the lists that contain tuples matching a regular expression.</p>
  
  <p>Basically I have:<br></p>
  
  <pre><code>start_list=[[(blah1,123)],[(xblah2,123)],[(somethingelse1,123)],[(wookie1,123)]]
  </code></pre>
  
  <p>I want to regex filter for anything that contains "blah" in index 0 of the tuples.<br>
  Expected Results:<br></p>
  
  <pre><code>result_list=[[(blah1,123)],[(xblah2,123)]]
  </code></pre>
  
  <p>What I have so far:</p>
  
  <pre><code>import re
  result_list=[[tup for tup in sub_list if re.search('.*blah.*',tup[0])] for sub_list in start_list]
  </code></pre>
  
  <p>However I keep getting errors with the regex<br></p>
  
  <pre><code>  File "/usr/lib/python2.7/re.py", line 137, in match
      return _compile(pattern, flags).match(string)
  TypeError: expected string or buffer
  </code></pre>
  
  <p>On top of that, I'm worried this will return blank lists for the tuples that don't match the regex.  Any help is appreciated, Thanks!</p>
  
  <p><strong>EDIT</strong>: OK my attempts at posing the problem more simply has led to me making typographic errors and such.  I apologize.  I'm using pysnmp getbulk and I wanted to get only the results that matched a base oid.  Here's what I get when I print the list of lists of a tuple:</p>
  
  <pre><code>[[(ObjectName(1.3.6.1.2.1.4.24.7.1.7.1.4.172.16.0.100.32.2.0.16777724.1.4.172.16.0.89), Integer(16777724))], [(ObjectName(1.3.6.1.2.1.4.24.7.1.7.1.4.172.16.0.100.32.2.0.16777724.1.4.172.16.0.90), Integer(16777724))], [(ObjectName(1.3.6.1.2.1.4.24.7.1.7.1.4.172.16.0.160.27.2.0.16778357.0.0), Integer(16778357))], [(ObjectName(1.3.6.1.2.1.4.24.7.1.7.1.4.172.16.0.192.29.2.0.16778348.0.0), Integer(16778348))]]
  </code></pre>
  
  <p>I'm just realized this ObjectName thing isn't a string so I guess I can't use regex on it.  But I do want to filter for the tuples that have the ObjectName that matches a base oid of:</p>
  
  <pre><code>1.3.6.1.2.1.4.24.7.1.7.1.4.172.16.0.100.32
  </code></pre>
  
  <p>I need to google what this ObjectName thing is now...</p>