I have a list that looks like:

name = name1 name2 name3 name4
and I would like to be able to arrange randomly this list, like:

name = name 2 name 1 name3 name4
name = name4 name2 name1 name3
....

I have tried with random.shuffle, but still no good result

May I get an example?

I'm not sure what you mean by "still no good result" as using random.shuffle works quite nicely:

>>> name = "name1 name2 name3 name4".split()
>>> name
['name1', 'name2', 'name3', 'name4']
>>> import random
>>> random.shuffle(name)
>>> name
['name1', 'name3', 'name4', 'name2']
>>> print ' '.join(name)
name1 name3 name4 name2

which is exactly what you describe...

-tkc




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

Reply via email to