python获得随机字符串,python字符串,如下代码生成随机密码字符
python获得随机字符串,python字符串,如下代码生成随机密码字符
如下代码生成随机密码字符串,引用了base64包,对字符做了base64编码。
import os, mathfrom base64 import b64encoderandStr = lambda n: b64encode(os.urandom(int(math.ceil(0.75*n))),'-_')[:n]for x in xrange(5): print randStr(10)
将输出:
WC9fGH_s3xnieUr8ZwFZltI4Aegb-rbOW9iOmhd8hTvhsuLK2S
相关内容
- python读写windows注册表,python读写windows,本文封装了_wi
- python使用pickle,json等序列化dict,picklejson,PersistentDi
- Python删除指定目录下的过期文件,,import osimp
- python使用atexit在程序退出时清理资源,pythonatexit,当进程
- python读取windows系统信息,python读取系统信息,需要使用
- python在windows下创建隐藏窗口的子进程,python窗口,impo
- python logging.basicConfig 封装,,第一次使用python的
- Python实现简单的缓存和缓存decorator,pythondecorator,一个简
- python解决八皇后算法,python皇后算法,python解决经典算法
- python下载Gmail邮箱中的所有邮件,pythongmail,#!/usr/bin/p
评论关闭