Skip to content

Instantly share code, notes, and snippets.

@PixelJunkie33
Created May 27, 2023 01:08
Show Gist options
  • Save PixelJunkie33/0a218156998bf1e00db622350b8129a5 to your computer and use it in GitHub Desktop.
Save PixelJunkie33/0a218156998bf1e00db622350b8129a5 to your computer and use it in GitHub Desktop.
import random
import string
def generate_password(length=10):
"""Generate a random password of specified length."""
characters = string.ascii_letters + string.digits + string.punctuation
password = ''.join(random.choice(characters) for _ in range(length))
return password
# Example usage
password = generate_password(12)
print("Generated Password:", password)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment