📅  最后修改于: 2022-03-11 14:46:29.650000             🧑  作者: Mango
def f(x):
result = []
for part in x.split(','):
if '-' in part:
a, b = part.split('-')
a, b = int(a), int(b)
result.extend(range(a, b + 1))
else:
a = int(part)
result.append(a)
return result