python string replace with number code example
Example 1: replace number with string python
x = re.sub(r"\d+", "NUMB", str(x)) #Replaces digits with 'NUMB'
Example 2: python string replace letters with numbers
from string import ascii_letters
code = code = "1111702460830000Lu05"
code = "".join([str(ascii_letters.index(c)) if c in ascii_letters else c for c in code])
print(code)