py-basic/randomString.py

12 lines
261 B
Python

import random
import string
def get_random_string(length):
# choose from all lowercase letter
letters = string.ascii_lowercase
result_str = ''.join(random.choice(letters) for i in range(length))
return result_str
print(get_random_string(20))