我从这里得到:Generating random words
import random
words = ['hello', 'apple', 'something', 'yeah', 'nope', 'lalala']
''.join(random.sample(words, 10))
applesomethinghellohellolalala
如何分割随机单词以便得到下面的结果?你知道吗
words = ['apple', 'something', 'hello', 'hello', 'lala']
而不是使用
正如Eugeny所建议的,我宁愿使用
random.choice
:试试这个:
相关问题 更多 >
编程相关推荐