python3 batch produced using the random function registered mail

'' 'You are a senior test engineer, now do performance testing, you need to write a function that generates a batch number of accounts registered for use.

1, end @ 163.com account is generated, the length input by the user, but also how many user generated input
2, the user name can not be repeated, a user name must be uppercase letters, lowercase letters, numbers, results as shown below:

 

 1 import random,string
 2 
 3 def users(count,legth):
 4     with open('users.txt','w') as f:
 5         for i in range(count):
 6             str1 = ''.join(random.sample(string.ascii_letters,legth-1))
 7             str2 = ''.join(random.sample(string.digits,3))
 8             f.write(str1 + str2 + '@163.com' + '\n')
. 9 COUNT = int (INPUT ( ' Please enter the mailbox number required to produce: ' ) .strip ())
 10 legth = int (INPUT ( ' Please enter the mailbox length: ' ) .strip ())
 . 11 Users (COUNT, legth )

 

1, end @ 163.com account is generated, the length input by the user, but also how many user generated input
2, the user name can not be repeated, a user name must be uppercase letters, lowercase letters, numbers, results as shown below:

Guess you like

Origin www.cnblogs.com/yizhipanghu/p/11263058.html