from random import Random#随机生成4到20位的用户名def random_username(): username = '' chars = 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz0123456789-_' length = len(chars) - 1 random = Random() for i in range(4,20): username +=chars[random.randint(0,
一句话生成电话号码random.choice(['139','188','185','136','158','151'])+"".join(random.choice("0123456789") for i in range(8)) random random是用于生成随机数的,我们可以利用它随机生成数字或者选择字符串. random.random() 用于生成一个随机浮点数:range[0.0,1.0) random.uniform(a,b) 用于