Le 15/03/2011 09:10, yqyq22 a écrit :
Hi all,
I would like to put an alphanumeric string like this one
EE472A86441AF2E629DE360 in a list, then iterate inside the entire
string lenght and change each digit with a random digit.
Do u have some suggestion? thanks a lot

This can be a way to begin :

s="EE472A86441AF2E629DE360"
for a in s:
   print a

The following is a very basic trick to build a list <t> containing the
elements of the string <s>

s="EE472A86441AF2E629DE360"
t=[]
for a in s:
   t.append(a)

All that you have to change is t.append(a) into something that
tests if a is a number and append something else in that case.

Depending what you want, you can even do

s.replace("1","ONE").replace("2","TWO").replace("3","FIVE")

This is however far from being random ;)

Have good tests
Laurent

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to