Write a random password generator in Python

Source: Internet
Author: User

1 #/bin/python32 ImportSYS3 Import Time4 ImportRandom5STRs = [i forIinchRange (32,128)] #产生密码的ASCII码的序列6Length =10 #生成密码长度7#下面这个函数用来生成Length长度的密码8 defrandomstr (strs,length):9Liststr = []Ten          forIinchRange (length): One liststr.append (Random.choice (STRs)) A         returnListstr - defstrings (): -String ="" thechar =randomstr (strs,length) -           forIinchChar: -string+=chr (i) -          returnstring +#上面这个函数将调用randomstr函数, returns a string password -  +Start =Time.time ACount =1 at -sc =strings () #调用函数生成密码 - Sys.stdout.write (SC)

This program can be used to generate a random password of a specified length, generally using about 10 bits

Generate passwords Remember to use some persistence method to save, cannot reproduce.

Write a random password generator in Python

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.