之前,我問我的問題,讓我得到這個直...爭奪Python列表
這不是Does anyone know a way to scramble the elements in a list?和Shuffle an array with python, randomize array item order with python重複。我會解釋爲什麼......
我想知道如何爭奪一個數組,作出新的副本。由於random.shuffle()
修改了列表(並返回None
),我想知道是否有另一種方法來執行此操作,因此我可以執行scrambled=scramblearray()
。如果沒有內置函數,我可以定義一個函數來做到這一點,如果可能的話。
出了什麼問題做一個新的副本,然後爭先恐後呢? – Marcin 2012-03-19 13:02:14
可能的重複[亂數組與python](http://stackoverflow.com/questions/473973/shuffle-an-array-with-python) – Marcin 2012-03-19 13:04:16
@Marcin個人而言,我不認爲這些答案可以合併與[隨機播放數組與Python]答案(http://stackoverflow.com/questions/473973/shuffle-an-array-with-python) – CoffeeRain 2012-03-19 13:17:26