我的问题是:如何以一行或一行打印密码? 我想知道如何在一行中打印输出。 我的代码是:
import random
import string
char = string.ascii_letters + string.digits + string.punctuation
lenght = random.randint(8, 16)
for i in range(lenght) :
password = ''.join(random.choice(char))
print('your password is === > ', password)
答案 0 :(得分:1)
我找到了一种方法,将字母打印在一行上
import random
import string
char = string.ascii_letters + string.digits + string.punctuation
lenght = random.randint(8, 16)
password = ''.join(random.choice(char) for x in range(lenght))
print('your password is === > ',password)