def random_string(
choose_from=None,
length=8
):
"""
Return a random sequence of characters
Args:
choose_from (Sequence): he set of eligible characters - by default
the set is string.ascii_lowercase + string.digits
length (int): the length of the sequence to be
returned (in characters, default 8)
Returns (string)
"""
choices = list(choose_from or (string.ascii_lowercase + string.digits))
return ''.join(
random.choice(choices)
for _ in range(length)
)
评论列表
文章目录