I've seen many solutions to the first part of my question, such as using:
name = 'Example 01 string 1a%'
new_name = ''.join(i for i in name if not i.isdigit())
print(new_name)
>> 'Example string a%'
However I would like the output to also replace 2+ adjacent spaces with only one space, and any characters that were connected to the removed digits (excluding spaces), so the result I expect in this example would be:
>> 'Example string'
I know that to remove for example double spaces, you could simple use:
new_name.replace(' ', ' ')
However this only works for double spaces. I am not sure how to extend this to an arbitrary amount, in case the string has multiple sets of digits which would be removed and leave behind large groups of space.
So my question is, how do I clean up a string to remove digits and any characters (excluding spaces) connected to those digits, and then replace any large groups of spaces with a single one?