Suppose I have a line, for example:
string = 'This string 22 is not yet perfect1234 and 123pretty but it can be.'
I want to delete all numbers , which are mixed with words such as 'perfect1234'
and '123pretty'
, but not '22'
of my line and get the output as follows:
string = 'This string 22 is not yet perfect and pretty but it can be.'
Is there a way to do this in Python using regex or any other method? Any help would be greatly appreciated. Thank!
source
share