#!/usr/bin/env python # use: python eigendoc.py cor_EIG.dat > eigendoc.dat import string,sys length = len(sys.argv[1:]) if length == 0: print "Usage: python eigendoc.py PREFIX_EIG_file" sys.exit(0) file = sys.argv[1] fp = open(file,'r') B = fp.readlines() fp.close() B = B[1:] # drop the 1st line k = 1 for line in B: s = string.split(line) percent = string.atof(s[1]) print "%5d 1%12f" % (k, percent) k += 1