Home > Backend Development > Python Tutorial > Python random password generation tutorial

Python random password generation tutorial

巴扎黑
Release: 2017-08-07 17:52:47
Original
1659 people have browsed it

This article mainly introduces the method of generating random passwords in Python in detail. It has certain reference value. Interested friends can refer to it.

The example of this article shares with you how to generate random passwords in Python. The specific code of the bit string is for your reference. The specific content is as follows


#coding:utf-8
#利用python生成一个随机10位的字符串
import string
import random
import re
list = list(string.lowercase + string.uppercase) + [ str(i) for i in range(10)]
FH = ('!','@','#','$','%','&','_')
for f in FH:
  list.append(f)
num = random.sample(list,10) 
'''随机取出10个数'''
str=''
value = str.join(num) #将取出的十个随机数进行重新合并
if not value[0].isdigit():
  print value
Copy after login

The above is the detailed content of Python random password generation tutorial. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template