python - enumerating numbers in strings -
python - enumerating numbers in strings - this seems problem have straight-forward answer; sadly, not fluent in python i'm still learning, , have not been able find helpful on google. my goal enumerate numbers in string based on how much padding number has. think best way describe example: 0-file enumerated 0-file 9-file but 000-file enumerated 000-file 999-file . ultimately want able [number][a-z] , [a-z][number] , , [a-z][number].* (so file10name.so wouldn't match), think can figure part out myself regex later on. so, question boils downwards this: how length of 'padding' in file? how identify in string number is, can replace it? how add together padding when i'm iterating (i'm assuming zfill , i'm interested if there's improve method). quick edit: yes, 'psudo regex' that. concept conveyed, hence why wouldn't match things "-". padding number, not 0, thats alright. both answers received far perfect. can