1def f(x):
2 result = []
3 for part in x.split(','):
4 if '-' in part:
5 a, b = part.split('-')
6 a, b = int(a), int(b)
7 result.extend(range(a, b + 1))
8 else:
9 a = int(part)
10 result.append(a)
11 return result