1import random
2import string
3
4def get_random_alphanumeric_string(length):
5 letters_and_digits = string.ascii_letters + string.digits
6 result_str = ''.join((random.choice(letters_and_digits) for i in range(length)))
7 print("Random alphanumeric String is:", result_str)
8
9get_random_alphanumeric_string(8)
10get_random_alphanumeric_string(8)
11
1''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(N))
2
1import random
2
3#String
4string = "abcdefghijklmnopqrstuvwxyz"
5array = []
6for c in string:
7 array += [c]
8
9print(array[random.randint(0, len(array)-1)])
10
11# Faster and more efficient
12random.choice(string)