This topic created in 3669 days ago, the information mentioned may be changed or developed.
现有一个 word 文件,里面有 200 个单词(一个单词一行),如果想随机分 18 组,每组 50 个,再输出到 word 里,可以用 python 实现吗?
具体该用什么实现?
3 replies • 2016-11-02 18:05:32 +08:00
 |
|
shuffle
|
 |
|
直接命令行操作如何? $ split -l 50 abc.txt
或者先简单乱序,再 split ? while read i; do echo "$i $RANDOM"; done< abc.txt | sort -k2n | cut -d" " -f1
|
 |
|
random.shuffle(words)
|