zoukankan      html  css  js  c++  java
  • python 随机生成用户名、密码、*

    #!C:Python
    #!/usr/bin/env python
    #-*- coding:utf-8 -*-
    
    import string
    import random
    
    minlength = 6
    maxlength = 16
    
    mobile_begin_seed = ['134','135','136','137','138','139','150','151','152','157','158','159','182','183','187','188','130','131','132','155','156','175','185','186','133','153','177','180','181','189']
    mobile_seed = string.digits
    username_seed = string.digits+string.ascii_letters
    password_seed = string.digits+string.ascii_letters+string.punctuation
     
    mobile = random.choice(mobile_begin_seed)+''.join(random.choice(mobile_seed) for m in range(8))
    username = ''.join(random.choice(username_seed) for u in range(random.randint(minlength,maxlength)))
    password = ''.join(random.choice(password_seed) for p in range(random.randint(minlength,maxlength)))
    
    with open("E:log.log",'a') as log,open ("E:mobile.txt",'a') as phone:
        log.write(username +'
    ')
        log.write(password +'
    ')
        phone.write(mobile +'
    ')
    
    print "The random generation mobile is:",mobile
    print "The random generation username is:",username
    print "The random generation password is:",password
  • 相关阅读:
    HTML_常用标签
    介绍Html_前端
    Mysql(2)数据类型与约束
    Mysql命令
    python_高级进阶(5)协程_事件
    python_高级进阶(4)同步_异步_回调函数_阻塞
    数据类型的补充以及各类型之间的相互转换
    二次编码
    坑坑坑坑坑坑----列表
    字典
  • 原文地址:https://www.cnblogs.com/smstars/p/5014265.html
Copyright © 2011-2022 走看看