fiddling.py 文件源码

python
阅读 53 收藏 0 点赞 0 评论 0

项目:black_zone 作者: zh-explorer 项目源码 文件源码
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))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号