How to generate 5 characters random string in Python

1 Answer

0 votes
import random
import string
  
s = ""
 
for i in range(5):
    s += random.choice(string.ascii_letters)
  
print(s)
  
  
  
  
'''
run:
  
QRsLu
  
'''

 



answered Sep 29, 2021 by avibootz
edited Sep 29, 2021 by avibootz
...