title: Python 3.4 : match from csv and return new csv with matched values
body: <h1>QUESTION</h1>
  
  <p>How can I scan the reader csv for any items in the reader2 csv and return a new csv with the matched information. </p>
  
  <h1>Reader2 csv format</h1>
  
  <pre><code>66740,1800,1001463,1467373,896159
  </code></pre>
  
  <h1>reader csv format</h1>
  
  <pre><code>1001385|NORTHWEST PIPE CO|10-Q|2015-05-06|edgar/data/1001385/0001193125-15-174814.txt
  1001426|PERICOM SEMICONDUCTOR CORP|10-Q|2015-05-05|edgar/data/1001426/0001145443-15-000628.txt
  1001463|Acacia Diversified Holdings, Inc.|10-K|2015-05-20|edgar/data/1001463/0001185185-15-001386.txt
  1001463|Acacia Diversified Holdings, Inc.|10-K|2015-05-20|edgar/data/1001463/0001185185-15-001394.txt
  1001463|Acacia Diversified Holdings, Inc.|10-Q|2015-05-20|edgar/data/1001463/0001185185-15-001388.txt
  1001463|Acacia Diversified Holdings, Inc.|10-Q|2015-05-20|edgar/data/1001463/0001185185-15-001390.txt
  1001463|Acacia Diversified Holdings, Inc.|10-Q|2015-05-20|edgar/data/1001463/0001185185-15-001392.txt
  1001463|Acacia Diversified Holdings, Inc.|10-Q|2015-05-20|edgar/data/1001463/0001185185-15-001396.txt
  </code></pre>
  
  <h1>Current Code</h1>
  
  <pre><code>with open('newCIK.csv') as reader2:
      reader2 = csv.reader(reader2)
  
      with open('search.file') as f_in, open('SP500_10K.csv', 'w') as f_out:
          reader = csv.reader(f_in, delimiter='|')
          writer = csv.writer(f_out, delimiter='|')
  
          for line in reader:
              for cik in reader2:
                  if cik in line:
                      writer.writerow(line)
  </code></pre>