How to compare one element of one array numerically to another element in another array in python
<p>I am new to python and made two arrays for two tab delimited input files.I was searching for a way to compare the column(element) of one array numerically to element of another array. Is there any way to do that.My code till now is as below</p>

<pre><code>#!/usr/bin/python
import sys
from array import *
#print len(sys.argv)
if len(sys.argv) != 4:
 print 'Usage: python scores.py &lt;infile1&gt; &lt;infile2&gt; &lt;outfile&gt;'
 sys.exit(1)

f1 = open ("12877overlappedallvariants.gvf", "r")
f2 = open ("unmatched.12877overlappedallvariants.gvf", "r")
f3 = open ("out.txt", "w")

for line in f1.readlines():
 cols = line.split('\t')
 #print cols[5:6]


for line in f2.readlines():
 cols1 = line.split('\t')
 #print cols1[5:6]
</code></pre>

<p>I tried this below section of code but does not work</p>

<pre><code>slice1 = cols[5:6]
slice2 = cols1[5:6]
new_list = []
for element in slice1:
 if element in slice2:
  new_list.append(element)
  print new_list  
</code></pre>

<p>I am trying to see if the element 5 of array1 is equal to, greater than or less than element 5 of array2. Any help is appreciated. Thanks.</p>
