def parse(line): if len(line) == 0 or line[0] == '#': return None return line.strip() celist = map(parse, celist_file) # parse lines and mark comments as None celist = filter(lambda x: x, celist) # remove all Nones tdir = testNo print 'USING:', tdir report = HTMLReport() report.beginDocument('LCG2 worker node capability scan: ' + testNo) testscript = 'test_wn_capabilities' shutil.copy(testscript, tdir) report.addParagraph(HTMLMarkup('capability testing script', link=testscript)) i = -1 for ce in celist: i += 1 print 'analysing output of', i, '', ce testcasename = "test_x_%d" % (i, ) fo = "%s/%s" % ( tdir, testcasename, )