84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
现有一个 word 文件,里面有 200 个单词(一个单词一行),如果想随机分 18 组,每组 50 个,再输出到 word 里,可以用 python 实现吗?
具体该用什么实现?
认证高级PHP讲师
You can use the product function in the itertools module. The approximate code is as follows:
import itertools lst = ['a', 'b', 'c'] #从word文件中将单词读到lst列表 repeat = 2 #这里就是你想分组的数目 for x in itertools.product(lst, repeat=2): print x
You can use the product function in the itertools module. The approximate code is as follows: