fork download
  1. def split_string(string, points):
  2. for left, right in zip(points, points[1:]):
  3. yield string[left:right]
  4.  
  5. print(list(split_string('AA111-99XYZ ', (0, 2, 4, 5, 8, 11))))
Success #stdin #stdout 0.15s 10224KB
stdin
Standard input is empty
stdout
['AA', '11', '1', '-99', 'XYZ']