python-random-choice関数



Python Random Choice Function



from random import choice def randpass(n=8): all='qwertyuiopasdfghjklzxcvbnm1234567890QWERTYUIOPASDFGHJKLZXCVBNM' zhi='' n=int(input('Please enter the number of passwords you want to set:')) for i in range(n): p = choice(all) zhi+=p return zhi if __name__ == '__main__': print(randpass()) print(randpass(4)) import shutil shutil.copy2