mirror of
https://hub.njuu.cf/TheAlgorithms/Python.git
synced 2023-10-11 13:06:12 +08:00
Simplify password_generator() (#4333)
This commit is contained in:
parent
cbe4d5f952
commit
ba974810d6
@ -16,7 +16,7 @@ def password_generator(length=8):
|
|||||||
>>> len(password_generator(-1))
|
>>> len(password_generator(-1))
|
||||||
0
|
0
|
||||||
"""
|
"""
|
||||||
chars = tuple(ascii_letters) + tuple(digits) + tuple(punctuation)
|
chars = ascii_letters + digits + punctuation
|
||||||
return "".join(choice(chars) for x in range(length))
|
return "".join(choice(chars) for x in range(length))
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user