import numpy as np import cPickle from array import array import sys filename1=sys.argv[1] filename2=sys.argv[2] filename3=sys.argv[3] filename4=sys.argv[4] feature_num=sys.argv[5] output_file=sys.argv[6] feature_num = int(feature_num) file1 = open(filename1,'r') count1 = len(open(filename1,'rU').readlines()) a = np.ndarray (shape=(count1,feature_num),dtype=np.float32); b = np.arange(count1); j=0 for line in file1: #line = file1.readline() if line.find('#') != -1: #if there is a comment at end of line, remove it line = line[:line.find('#')] #"slice" the portion after the # off. items = line.split(' ') items = [x for x in items if x != ' ' and x != ''] #remove any spaces that may be left i=0 while(i