Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

generate a random string with lowercase uppercase and numbers

import random
import string
 
## Length of the string
length = 12                     
 
lower = string.ascii_lowercase
upper = string.ascii_uppercase
num = string.digits
symbols = string.punctuation
 
all = lower + upper + num + symbols
 
temp = random.sample(all,length)
 
randstr = "".join(temp)
 
print(randstr)
Comment

PREVIOUS NEXT
Code Example
Python :: How to Add Elements to a dictionary using the update() method 
Python :: intersection_update() Function of sets in python 
Python :: How to clear out a set in python 
Python :: list of object in python 
Python :: webcolors python 
Python :: choose what items on python 
Python :: python generate c array 
Python :: how to get the string between brackets in a string in python 
Python :: how to extends page in django 
Python :: django not configured pylint error fix 
Python :: How to combine the output of multiple lists in python 
Python :: Python | Program to print duplicates from a list of integers 
Python :: python rest api interview questions 
Python :: pytrend 
Python :: hashmap in python 
Python :: django muti user for 3 users 
Python :: Django-rest-framework-simplejwt.readthedocs.io 
Python :: python os module using stat 
Python :: Random parola uretme 
Python :: upper method in python 
Python :: how to compare the two key from constant value to list of string in python 
Python :: reopen closed file python 
Python :: torch.cuda.randn 
Python :: strategy forex with python 
Python :: set shortcut for Qaction pyqt5 
Python :: python - from most_similar to ldictionary 
Python :: mo.group() separated with spaces instead of commas python 
Python :: how to vreate a list in python 
Python :: WARNING: Ignoring invalid distribution -pencv-python 
Python :: how to make a timer in pyothn 
ADD CONTENT
Topic
Content
Source link
Name
1+7 =