'How to list out the numbers in the given interval using Python?

I have a table with column A. How can I create a table like table B (9000 combined with all the numbers in the interval)? The data type is string.

A
9000(1-4)
9001(1-4)
B
90001
90002
90003
90004
90011
90012
90013
90014


Solution 1:[1]

This would be what you need.

a, b = [int(x[0]) for x in '9000(1-4)'.split('(', maxsplit=1)[1].split('-')]
l = [ 9000+x for x in range(a, b+1) ]
print(l)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 hochae