TIMEX
TIMEX

Reputation: 271774

Cannot shuffle list in Python

This is my list:

biglist = [ {'title':'U2','link':'u2.com'}, {'title':'beatles','link':'beatles.com'} ]
print random.shuffle(biglist)

that doesn't work! It returns none.

Upvotes: 3

Views: 2473

Answers (1)

Blixt
Blixt

Reputation: 50169

random.shuffle shuffles the list, it does not return a new list. So check biglist, not the result of random.shuffle.

Documentation for the random module: http://docs.python.org/library/random.html

Upvotes: 16

Related Questions