Python 3 中的随机密钥生成器
Random Key Generator In Python 3
我制作了一个随机密钥生成器,甚至可以用来为您创建新密码。
import random
chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890"
while 1:
key_len = int(input("What length would you like your key to be?: "))
key_count = int(input("How many keys would you like?: "))
for x in range(0,key_count):
key = ""
for x in range(0,key_len):
key_char = random.choice(chars)
key = key + key_char
print("Here's your key: ",key)
输出:
What length would you like your key to be?: 4
How many keys would you like?: 1
Here's your key: 1337
What length would you like your key to be?:
for x in range(0,key_len)
你忘了把冒号放在末尾。在我输入冒号代码后对我有用
for x in range(0,key_len):
我制作了一个随机密钥生成器,甚至可以用来为您创建新密码。
import random
chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890"
while 1:
key_len = int(input("What length would you like your key to be?: "))
key_count = int(input("How many keys would you like?: "))
for x in range(0,key_count):
key = ""
for x in range(0,key_len):
key_char = random.choice(chars)
key = key + key_char
print("Here's your key: ",key)
输出:
What length would you like your key to be?: 4
How many keys would you like?: 1
Here's your key: 1337
What length would you like your key to be?:
for x in range(0,key_len)
你忘了把冒号放在末尾。在我输入冒号代码后对我有用
for x in range(0,key_len):