Menu
Newbedev LogoNEWBEDEV Python Javascript Linux Cheat sheet
Newbedev LogoNEWBEDEV
  • Python 1
  • Javascript
  • Linux
  • Cheat sheet
  • Contact

random string and number generator code example

Example 1: generate random string python

import string
import random

length=5
#python2
randomstr = ''.join(random.sample(string.ascii_letters+string.digits,length))


#python3
randomstr = ''.join(random.choices(string.ascii_letters+string.digits,k=length))

Example 2: python generate random string

''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(N))

Tags:

Javascript Example

Related

how to change value of variable in html code example bootstrap class hide on download code example export import javascript es6 code example flask app to get input from form code example io.cucumber.testng.CucumberOptions code example all the prime numbers till n! in java code example power bi compare two columns from different tables code example python webserver comm code example open modal using javascript -jquery code example road the img reactjs code example compare two tables columns in sql code example decorator create django code example

Recent Posts

Pandas how to find column contains a certain value Recommended way to install multiple Python versions on Ubuntu 20.04 Build super fast web scraper with Python x100 than BeautifulSoup How to convert a SQL query result to a Pandas DataFrame in Python How to write a Pandas DataFrame to a .csv file in Python
© 2021 newbedevPrivacy Policy