import random
x=list(range(5))
# for i in range(5):
# print(random.choice(x))
# choice()选择一个
#Signature: random.choice(seq)
Docstring: Choose a random element from a non-empty sequence.
# choices()可以选择多个,指定k即可,返回列表,如果需要字符串可以''.join()
Signature: random.choices(population, weights=None, *, cum_weights=None, k=1)
Docstring:
Return a k sized list of population elements chosen with replacement.
#sample采样
print(random.sample(x,k=2))