def rndstr ( size = 16 ) : _basech = string . ascii_letters + string . digits return "" . join ( [ rnd . choice ( _basech ) for _ in range ( size ) ] )
python random string of n length
Returns a string of random ascii characters or digits
def rndstr(size=16):
    """
    Returns a string of random ascii characters or digits

    :param size: The length of the string
    :return: string
    """
    _basech = string.ascii_letters + string.digits
    return "".join([rnd.choice(_basech) for _ in range(size)])