def random_string ( string_length = 10 ) : random = str ( uuid . uuid4 ( ) ) # Convert UUID format to a Python string. random = random . upper ( ) # Make all characters uppercase. random = random . replace ( "-" , "" ) # Remove the UUID '-'. return random [ 0 : string_length ]
python uuid fixed length
Returns a random string of length string_length .
def random_string(string_length=10):
    """Returns a random string of length string_length."""
    random = str(uuid.uuid4())  # Convert UUID format to a Python string.
    random = random.upper()  # Make all characters uppercase.
    random = random.replace("-", "")  # Remove the UUID '-'.
    return random[0:string_length]