python 密码Generator.py

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python 密码Generator.py相关的知识,希望对你有一定的参考价值。

import string
import random
 
def main():
    while True:
        stop = input("Generate password? y/n: ")
        if stop and stop[0].lower() == "n":
            break
 
        length = int
 
        size = input("What length do you want the password to be(4-20): ")
        if size == "4":
            length = 4
        if size == "5":
            length = 5
        if size == "6":
            length = 6
        if size == "7":
            length = 7
        if size == "8":
            length = 8
        if size == "9":
            length = 9
        if size == "10":
            length = 10
        if size == "11":
            length = 11
        if size == "12":
            length = 12
        if size == "13":
            length = 13
        if size == "14":
            length = 14
        if size == "15":
            length = 15
        if size == "16":
            length = 16
        if size == "17":
            length = 17
        if size == "18":
            length = 18
        if size == "19":
            length = 19
        if size == "20":
            length = 20
        else:
            length = 6
 
        chars = string.ascii_letters + string.digits
        return ''.join(random.choice(chars) for x in range(length))

以上是关于python 密码Generator.py的主要内容,如果未能解决你的问题,请参考以下文章

python pdf_generator.py

python keras_generator.py

python autocomplete-generator.py

python 扑克手Generator.py

四则运算生成程序(python版)

四则运算题目生成(python版)