Generate user account with python

Account numbers include uppercase, lowercase letters and numbers, ending with @163.com

 1 import string
 2 import random
 3 
 4 def file_w(str):
 5     with open('账号.txt','a+',encoding='utf-8') as f:
 6         f.seek(0)
 7         f.write(str + '\n')
 8         f.flush()
 9 
10 # def file_r():
11 #     lines=[]
12 #     with open('账号.txt',encoding='utf-8') as f:
13 #          for line in f: 
14  #              lines.append(line) 
15  #      return lines 
16  
17 L1 = string.digits #digits 18 L2 = string.ascii_uppercase #uppercase 19 L3 = string.ascii_lowercase #lowercase 20 L4 = L1+ L2+ L3
 21 def file_n(m):
 22     n = input( ' Please enter the number of digits to generate: ' )
 23     n = int(n)
 24 for i in range(m):
 25


              user = random.sample(L1,1)+random.sample(L2,1)+random.sample(L3,1)+ random.sample(L4,n)
 26          random.shuffle(user)
 27          user = '' . join(user)+ ' @163.com ' 
28          file_w(user)
 29 m = input( ' Please enter the number of pieces to be generated: ' )
 30 m = int(m)
 31 file_n(m)

I have not judged whether the newly generated account exists, and I did not verify the input content when entering it. Please pay attention to it when writing, and add it later when you have time.

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325215611&siteId=291194637