def split_at_offsets(line, offsets):
 result = []
 previous_offset = 0
 current_offset = 0
 for current_offset in sorted(offsets):
  if ((current_offset < len(line)) and (previous_offset != current_offset)):
   result.append(line[previous_offset:current_offset].strip())
  previous_offset = current_offset
 result.append(line[current_offset:])
 return result

def split_at_offsets ( line , offsets ) : result = [ ] previous_offset = 0 current_offset = 0 for current_offset in sorted ( offsets ) : if ( ( current_offset < len ( line ) ) and ( previous_offset != current_offset ) ) : result . append ( line [ previous_offset : current_offset ] . strip ( ) ) previous_offset = current_offset result . append ( line [ current_offset : ] ) return result
split line at offsets .