I apologise if I annoy in advance. This is very close to what I want but I need to return a list of instr_numbers not just one and it seems that no matter what I do I just get two items from a split and not the three I need.. What I am getting not is just the last instr number and the comment (Maybe a bug in my re or in the split) thanks in advance for the help. The .csd text file that I am using to test this is available if needed at https://sourceforge.net/project/showfiles.php?group_id=156455&package_id=202823&re lease_id=452665
-
def csdInstrumentList(from_file):
-
"Returns a list of .csd instruments and any comment lines after the instrument"
-
infile = open(from_file, 'r')
-
temp_number = 0
-
for line in infile:
-
if 'instr' in line:
-
s = re.split(r' +',line,3)
-
instr_number = s[1]
-
return instr_number
-