def random_id ( length ) : def char ( ) : """Generate single random char""" return random . choice ( string . ascii_letters + string . digits ) return "" . join ( char ( ) for _ in range ( length ) )
python generate a guid
Generates a random ID of given length
def random_id(length):
    """Generates a random ID of given length"""

    def char():
        """Generate single random char"""

        return random.choice(string.ascii_letters + string.digits)

    return "".join(char() for _ in range(length))