Skip to content

Latest commit

 

History

History
18 lines (14 loc) · 411 Bytes

81.md

File metadata and controls

18 lines (14 loc) · 411 Bytes
@author jackzhenguo
@desc 
@date 2019/5/1

81 shuffle 重洗数据集

使用shuffle用来重洗数据集,值得注意shuffle是对lst就地(in place)洗牌,节省存储空间。

from random import shuffle
lst = [randint(0,50) for _ in range(100)]
shuffle(lst)
print(lst[:5]) # [50, 3, 48, 1, 26]
[上一个例子](80.md) [下一个例子](82.md)