title: Python: How do I combine functions to one
body: <p>I am new to python.
  Need help in writing the below code as one block of code, rather than using to if statements based on values.</p>
  
  <pre><code>    for lines in f:                                                     
  
          if 'et' in lines:
              # print lines
              value = re.search('(et-\d\\/\d\\/\d)', lines)
              if value:
                  interfaces = value.group(1)
                  # print interfaces
                  smic_dict.setdefault(pfe, []).append(interfaces)        
                  pfe_interfaces.append(interfaces)
  
          if 'xe' in lines:
              value_xe = re.search('(xe-\d\\/\d\\/\d)', lines)
              if value_xe:
                  interfaces_xe = value_xe.group(1)
                  smic_dict.setdefault(pfe, []).append(interfaces_xe) 
                  pfe_interfaces.append(interfaces_xe)
  </code></pre>
  
  <p>So far tried this:</p>
  
  <pre><code>        for lines in temp:
          if 'et' or 'xe' in lines:
              value = re.search('(et-\d\\/\d\\/\d)', lines)
              value_xe = re.search('(xe-\d\\/\d\\/\d)', lines)
              if value or value_xe:
                  interfaces = value.group(1)
                  pic_interfaces.append(interfaces)
  </code></pre>