Use random.choices instead of random.choice in a loop.

This commit is contained in:
voussoir 2021-08-09 08:46:36 -07:00
parent 9780368741
commit d36efec25f
No known key found for this signature in database
GPG key ID: 5F7554F8C26DACCB

View file

@ -1516,7 +1516,7 @@ setfont:
DOCSTRING = betterhelp.add_previews(DOCSTRING, SUB_DOCSTRINGS) DOCSTRING = betterhelp.add_previews(DOCSTRING, SUB_DOCSTRINGS)
def random_string(length, characters=string.ascii_lowercase): def random_string(length, characters=string.ascii_lowercase):
return ''.join(random.choice(characters) for x in range(length)) return ''.join(random.choices(characters, k=length))
def addfile_argparse(args): def addfile_argparse(args):
book = Epub(args.epub) book = Epub(args.epub)