I'm trying to create a range between two variables. The variables contain string and number characters.
For example P9160-P9163 or P360-P369. The P is not constant and could be any character(s)/multiple, but i'm trying to generate a list that would contain all values in between.
i tried with looking at ASCII characters but didn't work for me.
Any thoughts?
x = 'P9160'
y = 'P9163'
x = re.match(r"([a-z]+)([0-9]+)", x, re.I)
y = re.match(r"([a-z]+)([0-9]+)", y, re.I)
for i in range(int(x.groups()[1]), int(y.groups()[1])+1):
print("{}{}".format(x.groups()[0], i))