I have a list of objects and I want to shuffle them. I thought I could use the random.shuffle method, but this seems to fail when the list is of objects. Is the
random.shuffle
You can go for this:
>>> A = ['r','a','n','d','o','m'] >>> B = [1,2,3,4,5,6] >>> import random >>> random.sample(A+B, len(A+B)) [3, 'r', 4, 'n', 6, 5, 'm', 2, 1, 'a', 'o', 'd']
if you want to go back to two lists, you then split this long list into two.