python-random-choice函数

from random import choice

def randpass(n=8):
    all='qwertyuiopasdfghjklzxcvbnm1234567890QWERTYUIOPASDFGHJKLZXCVBNM'
    zhi=''
    n=int(input('请输入你想设置的密码位数:'))
    for i in range(n):
        p = choice(all)
        zhi+=p
    return zhi
if __name__ == '__main__':
    print(randpass())
    print(randpass(4))
import shutil
shutil.copy2

你可能感兴趣的:(python学习)