获得N位数字字母随机组合

import string

import random



def get_rand(n):

   allw = string.letters+string.digits

   r = []

   for i in range(n):

        r.append(random.choice(allw))

   return ''.join(r) 



for i in range(4):

    print get_rand(8) 

 

你可能感兴趣的:(数字)