import re

pattern = r"\b\d+\b|(\d)"
s = "my text contains of the 33109 following values RT3123SO55 and also with certain numbers godwil_5708 and 323stwe and 8y9yc2 456453"
print(re.sub(pattern, lambda x: 'X' if x.group(1) else x.group(), s))