i have the following string for Example
str = "TESTXXXXX"
and i want to replace each X with a number, so the output should be something like this:
TEST98965
not :
TEST66666
i made the following python script to do the job.
from sys import argv
from random import randint
bincode = argv[1].lower()
replaced = bincode.replace('x',str(randint(0,9)))
print replaced
it takes a input from a user, and replaces each 'x' with a random number, the problem here is that the script replaces all the 'x' with the same number, i want each 'x' to be replaced with a different number, for example if user input is:
xxx
the output would be something like this:
986
Any suggestions on how to do that?