problem with split

Eric_Dexter at msn.com Eric_Dexter at msn.com
Sat Oct 7 00:07:43 EDT 2006


apologies if I annoy and for spacing (google)



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

I am coming pretty close to what I want with variations on theis but I
cant seem to
get 3 lines with the split and instr_number[array] = s[1] seems to give
me an error.
the data from the line I am trying to split in three would look like
this

  instr 83     ;comment would be here

I want comment returned in an array and instr_number returned in an
array.




More information about the Python-list mailing list