本文摘自php中文网,作者巴扎黑,侵删。
这篇文章主要为大家详细介绍了Python生成随机密码的方法,具有一定的参考价值,感兴趣的小伙伴们可以参考一下本文实例为大家分享了python生成随机10位字符串的具体代码,供大家参考,具体内容如下
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 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 )
str = ''
value = str .join(num)
if not value[ 0 ].isdigit():
print value
|
以上就是Python随机密码的生成教程的详细内容,更多文章请关注木庄网络博客!!
相关阅读 >>
Python是一种什么类型的语言
Python如何垂直输出
Python中tornado协程的使用详解(附实例)
如何用Python做游戏
Python写错了怎么删除
Python编码用什么软件
Python中pow是什么
Python中index怎么用
Python怎么彻底卸载
Python如何安装批量下载
更多相关阅读请进入《Python》频道 >>
人民邮电出版社
python入门书籍,非常畅销,超高好评,python官方公认好书。
转载请注明出处:木庄网络博客 » Python随机密码的生成教程