All I am after realy is to change this reline = re.line.split('instr', '/d$')
into something that grabs any line with instr in it take all the numbers and then grab any comment that may or may not be at the end of the line starting with ; until the end of the line including white spaces.. this is a corrected version from http://python-forum.org/py/viewtopic.php?t=1703 thanks in advance the hole routine is down below.. [code] def extractCsdInstrument (input_File_Name, output_File_Name, instr_number): "takes an .csd input file and grabs instr_number instrument and creates output_File_Name" f = open (input_File_Name , 'r') #opens file passed in to read f2 = open (output_File_Name, 'w') #opens file passed in to write instr_yes = 'false' #set flag to false for line in f: #for through all the lines if "instr" in line: #look for instr in the file if instr_yes == 'true': #check to see if this ends the instr block break #exit the block reline = re.line.split('instr', '/d$') #error probily split instr and /d (decimal number into parts) $ for end of line number = int(reline[1]) #convert to a number maybe not important if number == instr_number: #check to see if it is the instr passed to function instr_yes = "true": #change flag to true because this is the instr we want if instr_yes = "true": #start of code to copy to another file f2.write(f.line) #write line to output file f.close #close input file f2.close [/code] -- http://mail.python.org/mailman/listinfo/python-list