Skip to content

Instantly share code, notes, and snippets.

@benmills
Created December 8, 2009 02:34
Show Gist options
  • Save benmills/251364 to your computer and use it in GitHub Desktop.
Save benmills/251364 to your computer and use it in GitHub Desktop.
import os
from optparse import OptionParser
#from scipy.stats import ks_2samp
parser = OptionParser ()
parser.set_defaults(verbose=False)
parser.set_defaults(infile=True)
parser.set_defaults(outfile=True)
parser.add_option("-v", "--verbose", dest = "verbose", action = "store_true", help = "prints information about the programs")
parser.add_option("-i", "--infile", dest = "infile", action = "store", help = "requires input file location")
parser.add_option("-o", "--outfile", dest = "outfile",action = "store", help = "requires output file location")
(options, args) = parser.parse_args()
all_data = []
for file in os.listdir(options.infile):
filename = options.infile + "/" + file
inputfile = open(filename, "r")
input = inputfile.readlines()
dict_files = []
for line in input:
line = line.strip()
sep = line.split(" ")
dict_files.append(sep)
all_data.append(dict_files)
# Working with all data:
for i in range(0, len(all_data)):
if (len(all_data) >= i+2):
print 'have both, now do something'
else:
print 'end, only have one left'
# Compare all vs eachother
for i in range(0, len(all_data)):
for ii in range(0, len(all_data)):
if (ii != i): print(str(i)+'..'+str(ii))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment