程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Use python to verify password strength

編輯:Python

python's built-in library string is a good thing, using string can be used to generate passwords, or surprise password strength detection;

Randomly generate passwords
When it comes to randomness, we can't help but mention another built-in library random in python;
random is a random number function, including multiple random number generatorsMethod:

  • random.random() is used to generate a floating point number in the range [0,1)
  • random.uniform(a, b) is used to generate a random number of symbols within a specified range, one of the two parameters is the upper limit and the other is the lower limit
  • random.randint(a, b) is used to generate an integer in the specified range.where parameter a is the lower limit and parameter b is the upper limit
  • random.choice(string) chooses a random character from a string

string is a built-in string in python;

whitespace = ' \t\n\r\v\f'ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'ascii_letters = ascii_lowercase + ascii_uppercasedigits = '0123456789'hexdigits = digits + 'abcdef' + 'ABCDEF'octdigits = '01234567'punctuation = r"""!"#$%&'()*+,-./:;<=>[email protected][\]^_`{|}~"""printable = digits +

  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved