Cannot shuffle a list in Python

This is my list:

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

this does not work! It does not return anything.

+3
source share
1 answer

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

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

+16
source

Source: https://habr.com/ru/post/1719492/


All Articles