What is the cleanest way to obtain the numeric prefix of a string in Python?
By \"clean\" I mean simple, short, readable. I couldn\'t care less about performance, a
You could use regex
import re initialNumber = re.match(r'(?P\d+)', yourInput).group('number')