Since strings are iterables, you can do this one liner:
import random
result = "".join(random.choice("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789") for i in range(0, 10))
Assigns a string containing 10 random characters from the provided string
In some cases, code editors might complain when you assign throwaway variables like i without accessing them. By convention, use _ instead to indicate that the variable is a throwaway.