Skip to main content

Generates a random string of a specified length.

Project description


Generates a random string of a specified length.


Currently there are 5 types:

  • uppercase
  • lowercase
  • upperlower
  • alphanumerical
  • ascii

You can probably guess what each one would create

The function requires 2 parameters type and length; Type of course is the above.

import rand_string.rand_string as rand
rand.RandString(type, length)

Now lets look at some examples


print(rand.RandString("uppercase", 10))


print(rand.RandString("lowercase", 10))
# Output: mdvsewzkwf


print(rand.RandString("upperlower", 10))
# Output: YjHFGzysFx


print(rand.RandString("alphanumerical", 10))
# Output: Fy0Nbqno6B


print(rand.RandString("ascii", 10))
# Output: jtj-NV<PSV

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for rand-string, version 0.50
Filename, size File type Python version Upload date Hashes
Filename, size rand-string-0.50.tar.gz (2.0 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page