def random_string(length): pool = string.ascii_letters + string.digits return ''.join(random.choice(pool) for i in range(length))