Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to generate string of random character in 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))
    print("Random string of length", length, "is:", result_str)

get_random_string(8)
get_random_string(6)
get_random_string(4)
Source by pynative.com #
 
PREVIOUS NEXT
Tagged: #generate #string #random #character #python
ADD COMMENT
Topic
Name
8+8 =