def randoms(count, alphabet = string.lowercase):
"""randoms(count, alphabet = string.lowercase) -> str
Returns a random string of a given length using only the specified alphabet.
Arguments:
count (int): The length of the desired string.
alphabet: The alphabet of allowed characters. Defaults to all lowercase characters.
Returns:
A random string.
Example:
>>> randoms(10) #doctest: +SKIP
'evafjilupm'
"""
return ''.join(random.choice(alphabet) for _ in xrange(count))
评论列表
文章目录