The format is something like: 1,2-6,9,11-12.

I have no idea if there is something more compact in python?