You can download this code by clicking the button below.
This code is now available for download.
This function is used to generate a random string of specified length, often used in password generation, captcha, etc.
Technology Stack : String manipulation, random number generation
Code Type : Generate random strings
Code Difficulty : Intermediate
import string
import random
import datetime
import os
import sys
import json
def generate_random_string(length=10):
letters = string.ascii_letters
return ''.join(random.choice(letters) for i in range(length))