(length, selectable=None)
return ''.join([choice(selectable) for _ in range(length)])
Create a random string of the specified length.

    :param int length: How long the string must be.
    :param str selectable: If left unspecified, the random character selection
        will be taken from uppercase and lowercase letters, digits, and a few
        punctuation marks.  Otherwise, the characters will be taken from the
        string provided.
    :returns: A string of length `length`.
Create a random string of the specified length.
Create a random string of the specified length .
def random_string(length, selectable=None):
    """
    Create a random string of the specified length.

    :param int length: How long the string must be.
    :param str selectable: If left unspecified, the random character selection
        will be taken from uppercase and lowercase letters, digits, and a few
        punctuation marks.  Otherwise, the characters will be taken from the
        string provided.
    :returns: A string of length `length`.
    """
    selectable = (
        selectable or (string.ascii_letters + string.digits
                       + string.punctuation)
    )
    return ''.join([choice(selectable) for _ in range(length)])
def random_string ( length , selectable = None ) : selectable = ( selectable or ( string . ascii_letters + string . digits + string . punctuation ) ) return '' . join ( [ choice ( selectable ) for _ in range ( length ) ] )