我想从随机数字和字母生成一个列表。我设法做到了:
def rand_num():
while True:
random_char= random.choice(string.ascii_letters+string.digits)
random_lst= [random_char]
但是当我想打印这个列表时,print random_lst
我得到这样的输出:
['W']
['i']
['P']
['6']
['P']
['B']
['d']
['f']
['n']
['j']
代替:
['W','i','P'
.... 等等
我应该怎么办?在这种情况下 .choice 是错误的功能吗?